@probelabs/visor 0.1.95 → 0.1.96

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- process.env.VISOR_VERSION = '0.1.95';
3
- process.env.PROBE_VERSION = '0.6.0-rc145';
2
+ process.env.VISOR_VERSION = '0.1.96';
3
+ process.env.PROBE_VERSION = '0.6.0-rc146';
4
4
  /******/ (() => { // webpackBootstrap
5
5
  /******/ var __webpack_modules__ = ({
6
6
 
@@ -177300,6 +177300,522 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
177300
177300
  };
177301
177301
 
177302
177302
 
177303
+ /***/ }),
177304
+
177305
+ /***/ 52874:
177306
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => {
177307
+
177308
+ (function () {
177309
+ (__nccwpck_require__(18889).config)(
177310
+ Object.assign(
177311
+ {},
177312
+ __nccwpck_require__(39990),
177313
+ __nccwpck_require__(4531)(process.argv)
177314
+ )
177315
+ )
177316
+ })()
177317
+
177318
+
177319
+ /***/ }),
177320
+
177321
+ /***/ 4531:
177322
+ /***/ ((module) => {
177323
+
177324
+ const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/
177325
+
177326
+ module.exports = function optionMatcher (args) {
177327
+ const options = args.reduce(function (acc, cur) {
177328
+ const matches = cur.match(re)
177329
+ if (matches) {
177330
+ acc[matches[1]] = matches[2]
177331
+ }
177332
+ return acc
177333
+ }, {})
177334
+
177335
+ if (!('quiet' in options)) {
177336
+ options.quiet = 'true'
177337
+ }
177338
+
177339
+ return options
177340
+ }
177341
+
177342
+
177343
+ /***/ }),
177344
+
177345
+ /***/ 39990:
177346
+ /***/ ((module) => {
177347
+
177348
+ // ../config.js accepts options via environment variables
177349
+ const options = {}
177350
+
177351
+ if (process.env.DOTENV_CONFIG_ENCODING != null) {
177352
+ options.encoding = process.env.DOTENV_CONFIG_ENCODING
177353
+ }
177354
+
177355
+ if (process.env.DOTENV_CONFIG_PATH != null) {
177356
+ options.path = process.env.DOTENV_CONFIG_PATH
177357
+ }
177358
+
177359
+ if (process.env.DOTENV_CONFIG_QUIET != null) {
177360
+ options.quiet = process.env.DOTENV_CONFIG_QUIET
177361
+ }
177362
+
177363
+ if (process.env.DOTENV_CONFIG_DEBUG != null) {
177364
+ options.debug = process.env.DOTENV_CONFIG_DEBUG
177365
+ }
177366
+
177367
+ if (process.env.DOTENV_CONFIG_OVERRIDE != null) {
177368
+ options.override = process.env.DOTENV_CONFIG_OVERRIDE
177369
+ }
177370
+
177371
+ if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
177372
+ options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY
177373
+ }
177374
+
177375
+ module.exports = options
177376
+
177377
+
177378
+ /***/ }),
177379
+
177380
+ /***/ 18889:
177381
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
177382
+
177383
+ const fs = __nccwpck_require__(79896)
177384
+ const path = __nccwpck_require__(16928)
177385
+ const os = __nccwpck_require__(70857)
177386
+ const crypto = __nccwpck_require__(76982)
177387
+ const packageJson = __nccwpck_require__(80056)
177388
+
177389
+ const version = packageJson.version
177390
+
177391
+ // Array of tips to display randomly
177392
+ const TIPS = [
177393
+ '🔐 encrypt with Dotenvx: https://dotenvx.com',
177394
+ '🔐 prevent committing .env to code: https://dotenvx.com/precommit',
177395
+ '🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
177396
+ '📡 add observability to secrets: https://dotenvx.com/ops',
177397
+ '👥 sync secrets across teammates & machines: https://dotenvx.com/ops',
177398
+ '🗂️ backup and recover secrets: https://dotenvx.com/ops',
177399
+ '✅ audit secrets and track compliance: https://dotenvx.com/ops',
177400
+ '🔄 add secrets lifecycle management: https://dotenvx.com/ops',
177401
+ '🔑 add access controls to secrets: https://dotenvx.com/ops',
177402
+ '🛠️ run anywhere with `dotenvx run -- yourcommand`',
177403
+ '⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
177404
+ '⚙️ enable debug logging with { debug: true }',
177405
+ '⚙️ override existing env vars with { override: true }',
177406
+ '⚙️ suppress all logs with { quiet: true }',
177407
+ '⚙️ write to custom object with { processEnv: myObject }',
177408
+ '⚙️ load multiple .env files with { path: [\'.env.local\', \'.env\'] }'
177409
+ ]
177410
+
177411
+ // Get a random tip from the tips array
177412
+ function _getRandomTip () {
177413
+ return TIPS[Math.floor(Math.random() * TIPS.length)]
177414
+ }
177415
+
177416
+ function parseBoolean (value) {
177417
+ if (typeof value === 'string') {
177418
+ return !['false', '0', 'no', 'off', ''].includes(value.toLowerCase())
177419
+ }
177420
+ return Boolean(value)
177421
+ }
177422
+
177423
+ function supportsAnsi () {
177424
+ return process.stdout.isTTY // && process.env.TERM !== 'dumb'
177425
+ }
177426
+
177427
+ function dim (text) {
177428
+ return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text
177429
+ }
177430
+
177431
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
177432
+
177433
+ // Parse src into an Object
177434
+ function parse (src) {
177435
+ const obj = {}
177436
+
177437
+ // Convert buffer to string
177438
+ let lines = src.toString()
177439
+
177440
+ // Convert line breaks to same format
177441
+ lines = lines.replace(/\r\n?/mg, '\n')
177442
+
177443
+ let match
177444
+ while ((match = LINE.exec(lines)) != null) {
177445
+ const key = match[1]
177446
+
177447
+ // Default undefined or null to empty string
177448
+ let value = (match[2] || '')
177449
+
177450
+ // Remove whitespace
177451
+ value = value.trim()
177452
+
177453
+ // Check if double quoted
177454
+ const maybeQuote = value[0]
177455
+
177456
+ // Remove surrounding quotes
177457
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2')
177458
+
177459
+ // Expand newlines if double quoted
177460
+ if (maybeQuote === '"') {
177461
+ value = value.replace(/\\n/g, '\n')
177462
+ value = value.replace(/\\r/g, '\r')
177463
+ }
177464
+
177465
+ // Add to object
177466
+ obj[key] = value
177467
+ }
177468
+
177469
+ return obj
177470
+ }
177471
+
177472
+ function _parseVault (options) {
177473
+ options = options || {}
177474
+
177475
+ const vaultPath = _vaultPath(options)
177476
+ options.path = vaultPath // parse .env.vault
177477
+ const result = DotenvModule.configDotenv(options)
177478
+ if (!result.parsed) {
177479
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
177480
+ err.code = 'MISSING_DATA'
177481
+ throw err
177482
+ }
177483
+
177484
+ // handle scenario for comma separated keys - for use with key rotation
177485
+ // example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
177486
+ const keys = _dotenvKey(options).split(',')
177487
+ const length = keys.length
177488
+
177489
+ let decrypted
177490
+ for (let i = 0; i < length; i++) {
177491
+ try {
177492
+ // Get full key
177493
+ const key = keys[i].trim()
177494
+
177495
+ // Get instructions for decrypt
177496
+ const attrs = _instructions(result, key)
177497
+
177498
+ // Decrypt
177499
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)
177500
+
177501
+ break
177502
+ } catch (error) {
177503
+ // last key
177504
+ if (i + 1 >= length) {
177505
+ throw error
177506
+ }
177507
+ // try next key
177508
+ }
177509
+ }
177510
+
177511
+ // Parse decrypted .env string
177512
+ return DotenvModule.parse(decrypted)
177513
+ }
177514
+
177515
+ function _warn (message) {
177516
+ console.error(`[dotenv@${version}][WARN] ${message}`)
177517
+ }
177518
+
177519
+ function _debug (message) {
177520
+ console.log(`[dotenv@${version}][DEBUG] ${message}`)
177521
+ }
177522
+
177523
+ function _log (message) {
177524
+ console.log(`[dotenv@${version}] ${message}`)
177525
+ }
177526
+
177527
+ function _dotenvKey (options) {
177528
+ // prioritize developer directly setting options.DOTENV_KEY
177529
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
177530
+ return options.DOTENV_KEY
177531
+ }
177532
+
177533
+ // secondary infra already contains a DOTENV_KEY environment variable
177534
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
177535
+ return process.env.DOTENV_KEY
177536
+ }
177537
+
177538
+ // fallback to empty string
177539
+ return ''
177540
+ }
177541
+
177542
+ function _instructions (result, dotenvKey) {
177543
+ // Parse DOTENV_KEY. Format is a URI
177544
+ let uri
177545
+ try {
177546
+ uri = new URL(dotenvKey)
177547
+ } catch (error) {
177548
+ if (error.code === 'ERR_INVALID_URL') {
177549
+ 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')
177550
+ err.code = 'INVALID_DOTENV_KEY'
177551
+ throw err
177552
+ }
177553
+
177554
+ throw error
177555
+ }
177556
+
177557
+ // Get decrypt key
177558
+ const key = uri.password
177559
+ if (!key) {
177560
+ const err = new Error('INVALID_DOTENV_KEY: Missing key part')
177561
+ err.code = 'INVALID_DOTENV_KEY'
177562
+ throw err
177563
+ }
177564
+
177565
+ // Get environment
177566
+ const environment = uri.searchParams.get('environment')
177567
+ if (!environment) {
177568
+ const err = new Error('INVALID_DOTENV_KEY: Missing environment part')
177569
+ err.code = 'INVALID_DOTENV_KEY'
177570
+ throw err
177571
+ }
177572
+
177573
+ // Get ciphertext payload
177574
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`
177575
+ const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION
177576
+ if (!ciphertext) {
177577
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
177578
+ err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'
177579
+ throw err
177580
+ }
177581
+
177582
+ return { ciphertext, key }
177583
+ }
177584
+
177585
+ function _vaultPath (options) {
177586
+ let possibleVaultPath = null
177587
+
177588
+ if (options && options.path && options.path.length > 0) {
177589
+ if (Array.isArray(options.path)) {
177590
+ for (const filepath of options.path) {
177591
+ if (fs.existsSync(filepath)) {
177592
+ possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`
177593
+ }
177594
+ }
177595
+ } else {
177596
+ possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`
177597
+ }
177598
+ } else {
177599
+ possibleVaultPath = path.resolve(process.cwd(), '.env.vault')
177600
+ }
177601
+
177602
+ if (fs.existsSync(possibleVaultPath)) {
177603
+ return possibleVaultPath
177604
+ }
177605
+
177606
+ return null
177607
+ }
177608
+
177609
+ function _resolveHome (envPath) {
177610
+ return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
177611
+ }
177612
+
177613
+ function _configVault (options) {
177614
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || (options && options.debug))
177615
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet))
177616
+
177617
+ if (debug || !quiet) {
177618
+ _log('Loading env from encrypted .env.vault')
177619
+ }
177620
+
177621
+ const parsed = DotenvModule._parseVault(options)
177622
+
177623
+ let processEnv = process.env
177624
+ if (options && options.processEnv != null) {
177625
+ processEnv = options.processEnv
177626
+ }
177627
+
177628
+ DotenvModule.populate(processEnv, parsed, options)
177629
+
177630
+ return { parsed }
177631
+ }
177632
+
177633
+ function configDotenv (options) {
177634
+ const dotenvPath = path.resolve(process.cwd(), '.env')
177635
+ let encoding = 'utf8'
177636
+ let processEnv = process.env
177637
+ if (options && options.processEnv != null) {
177638
+ processEnv = options.processEnv
177639
+ }
177640
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || (options && options.debug))
177641
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || (options && options.quiet))
177642
+
177643
+ if (options && options.encoding) {
177644
+ encoding = options.encoding
177645
+ } else {
177646
+ if (debug) {
177647
+ _debug('No encoding is specified. UTF-8 is used by default')
177648
+ }
177649
+ }
177650
+
177651
+ let optionPaths = [dotenvPath] // default, look for .env
177652
+ if (options && options.path) {
177653
+ if (!Array.isArray(options.path)) {
177654
+ optionPaths = [_resolveHome(options.path)]
177655
+ } else {
177656
+ optionPaths = [] // reset default
177657
+ for (const filepath of options.path) {
177658
+ optionPaths.push(_resolveHome(filepath))
177659
+ }
177660
+ }
177661
+ }
177662
+
177663
+ // Build the parsed data in a temporary object (because we need to return it). Once we have the final
177664
+ // parsed data, we will combine it with process.env (or options.processEnv if provided).
177665
+ let lastError
177666
+ const parsedAll = {}
177667
+ for (const path of optionPaths) {
177668
+ try {
177669
+ // Specifying an encoding returns a string instead of a buffer
177670
+ const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))
177671
+
177672
+ DotenvModule.populate(parsedAll, parsed, options)
177673
+ } catch (e) {
177674
+ if (debug) {
177675
+ _debug(`Failed to load ${path} ${e.message}`)
177676
+ }
177677
+ lastError = e
177678
+ }
177679
+ }
177680
+
177681
+ const populated = DotenvModule.populate(processEnv, parsedAll, options)
177682
+
177683
+ // handle user settings DOTENV_CONFIG_ options inside .env file(s)
177684
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug)
177685
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet)
177686
+
177687
+ if (debug || !quiet) {
177688
+ const keysCount = Object.keys(populated).length
177689
+ const shortPaths = []
177690
+ for (const filePath of optionPaths) {
177691
+ try {
177692
+ const relative = path.relative(process.cwd(), filePath)
177693
+ shortPaths.push(relative)
177694
+ } catch (e) {
177695
+ if (debug) {
177696
+ _debug(`Failed to load ${filePath} ${e.message}`)
177697
+ }
177698
+ lastError = e
177699
+ }
177700
+ }
177701
+
177702
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(',')} ${dim(`-- tip: ${_getRandomTip()}`)}`)
177703
+ }
177704
+
177705
+ if (lastError) {
177706
+ return { parsed: parsedAll, error: lastError }
177707
+ } else {
177708
+ return { parsed: parsedAll }
177709
+ }
177710
+ }
177711
+
177712
+ // Populates process.env from .env file
177713
+ function config (options) {
177714
+ // fallback to original dotenv if DOTENV_KEY is not set
177715
+ if (_dotenvKey(options).length === 0) {
177716
+ return DotenvModule.configDotenv(options)
177717
+ }
177718
+
177719
+ const vaultPath = _vaultPath(options)
177720
+
177721
+ // dotenvKey exists but .env.vault file does not exist
177722
+ if (!vaultPath) {
177723
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`)
177724
+
177725
+ return DotenvModule.configDotenv(options)
177726
+ }
177727
+
177728
+ return DotenvModule._configVault(options)
177729
+ }
177730
+
177731
+ function decrypt (encrypted, keyStr) {
177732
+ const key = Buffer.from(keyStr.slice(-64), 'hex')
177733
+ let ciphertext = Buffer.from(encrypted, 'base64')
177734
+
177735
+ const nonce = ciphertext.subarray(0, 12)
177736
+ const authTag = ciphertext.subarray(-16)
177737
+ ciphertext = ciphertext.subarray(12, -16)
177738
+
177739
+ try {
177740
+ const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)
177741
+ aesgcm.setAuthTag(authTag)
177742
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
177743
+ } catch (error) {
177744
+ const isRange = error instanceof RangeError
177745
+ const invalidKeyLength = error.message === 'Invalid key length'
177746
+ const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'
177747
+
177748
+ if (isRange || invalidKeyLength) {
177749
+ const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')
177750
+ err.code = 'INVALID_DOTENV_KEY'
177751
+ throw err
177752
+ } else if (decryptionFailed) {
177753
+ const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')
177754
+ err.code = 'DECRYPTION_FAILED'
177755
+ throw err
177756
+ } else {
177757
+ throw error
177758
+ }
177759
+ }
177760
+ }
177761
+
177762
+ // Populate process.env with parsed values
177763
+ function populate (processEnv, parsed, options = {}) {
177764
+ const debug = Boolean(options && options.debug)
177765
+ const override = Boolean(options && options.override)
177766
+ const populated = {}
177767
+
177768
+ if (typeof parsed !== 'object') {
177769
+ const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
177770
+ err.code = 'OBJECT_REQUIRED'
177771
+ throw err
177772
+ }
177773
+
177774
+ // Set process.env
177775
+ for (const key of Object.keys(parsed)) {
177776
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
177777
+ if (override === true) {
177778
+ processEnv[key] = parsed[key]
177779
+ populated[key] = parsed[key]
177780
+ }
177781
+
177782
+ if (debug) {
177783
+ if (override === true) {
177784
+ _debug(`"${key}" is already defined and WAS overwritten`)
177785
+ } else {
177786
+ _debug(`"${key}" is already defined and was NOT overwritten`)
177787
+ }
177788
+ }
177789
+ } else {
177790
+ processEnv[key] = parsed[key]
177791
+ populated[key] = parsed[key]
177792
+ }
177793
+ }
177794
+
177795
+ return populated
177796
+ }
177797
+
177798
+ const DotenvModule = {
177799
+ configDotenv,
177800
+ _configVault,
177801
+ _parseVault,
177802
+ config,
177803
+ decrypt,
177804
+ parse,
177805
+ populate
177806
+ }
177807
+
177808
+ module.exports.configDotenv = DotenvModule.configDotenv
177809
+ module.exports._configVault = DotenvModule._configVault
177810
+ module.exports._parseVault = DotenvModule._parseVault
177811
+ module.exports.config = DotenvModule.config
177812
+ module.exports.decrypt = DotenvModule.decrypt
177813
+ module.exports.parse = DotenvModule.parse
177814
+ module.exports.populate = DotenvModule.populate
177815
+
177816
+ module.exports = DotenvModule
177817
+
177818
+
177303
177819
  /***/ }),
177304
177820
 
177305
177821
  /***/ 26669:
@@ -224380,6 +224896,8 @@ var __importStar = (this && this.__importStar) || (function () {
224380
224896
  })();
224381
224897
  Object.defineProperty(exports, "__esModule", ({ value: true }));
224382
224898
  exports.main = main;
224899
+ // Load environment variables from .env file
224900
+ __nccwpck_require__(52874);
224383
224901
  const cli_1 = __nccwpck_require__(95581);
224384
224902
  const config_1 = __nccwpck_require__(22973);
224385
224903
  const check_execution_engine_1 = __nccwpck_require__(80299);
@@ -229828,6 +230346,8 @@ var __importStar = (this && this.__importStar) || (function () {
229828
230346
  Object.defineProperty(exports, "__esModule", ({ value: true }));
229829
230347
  exports.deriveExecutedCheckNames = void 0;
229830
230348
  exports.run = run;
230349
+ // Load environment variables from .env file
230350
+ __nccwpck_require__(52874);
229831
230351
  const rest_1 = __nccwpck_require__(47432);
229832
230352
  const auth_app_1 = __nccwpck_require__(76479);
229833
230353
  const core_1 = __nccwpck_require__(37484);
@@ -254293,6 +254813,364 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
254293
254813
  ));
254294
254814
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
254295
254815
 
254816
+ // node_modules/dotenv/package.json
254817
+ var require_package = __commonJS({
254818
+ "node_modules/dotenv/package.json"(exports2, module2) {
254819
+ module2.exports = {
254820
+ name: "dotenv",
254821
+ version: "16.6.1",
254822
+ description: "Loads environment variables from .env file",
254823
+ main: "lib/main.js",
254824
+ types: "lib/main.d.ts",
254825
+ exports: {
254826
+ ".": {
254827
+ types: "./lib/main.d.ts",
254828
+ require: "./lib/main.js",
254829
+ default: "./lib/main.js"
254830
+ },
254831
+ "./config": "./config.js",
254832
+ "./config.js": "./config.js",
254833
+ "./lib/env-options": "./lib/env-options.js",
254834
+ "./lib/env-options.js": "./lib/env-options.js",
254835
+ "./lib/cli-options": "./lib/cli-options.js",
254836
+ "./lib/cli-options.js": "./lib/cli-options.js",
254837
+ "./package.json": "./package.json"
254838
+ },
254839
+ scripts: {
254840
+ "dts-check": "tsc --project tests/types/tsconfig.json",
254841
+ lint: "standard",
254842
+ pretest: "npm run lint && npm run dts-check",
254843
+ test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
254844
+ "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
254845
+ prerelease: "npm test",
254846
+ release: "standard-version"
254847
+ },
254848
+ repository: {
254849
+ type: "git",
254850
+ url: "git://github.com/motdotla/dotenv.git"
254851
+ },
254852
+ homepage: "https://github.com/motdotla/dotenv#readme",
254853
+ funding: "https://dotenvx.com",
254854
+ keywords: [
254855
+ "dotenv",
254856
+ "env",
254857
+ ".env",
254858
+ "environment",
254859
+ "variables",
254860
+ "config",
254861
+ "settings"
254862
+ ],
254863
+ readmeFilename: "README.md",
254864
+ license: "BSD-2-Clause",
254865
+ devDependencies: {
254866
+ "@types/node": "^18.11.3",
254867
+ decache: "^4.6.2",
254868
+ sinon: "^14.0.1",
254869
+ standard: "^17.0.0",
254870
+ "standard-version": "^9.5.0",
254871
+ tap: "^19.2.0",
254872
+ typescript: "^4.8.4"
254873
+ },
254874
+ engines: {
254875
+ node: ">=12"
254876
+ },
254877
+ browser: {
254878
+ fs: false
254879
+ }
254880
+ };
254881
+ }
254882
+ });
254883
+
254884
+ // node_modules/dotenv/lib/main.js
254885
+ var require_main = __commonJS({
254886
+ "node_modules/dotenv/lib/main.js"(exports2, module2) {
254887
+ var fs6 = __nccwpck_require__(79896);
254888
+ var path7 = __nccwpck_require__(16928);
254889
+ var os3 = __nccwpck_require__(70857);
254890
+ var crypto2 = __nccwpck_require__(76982);
254891
+ var packageJson = require_package();
254892
+ var version = packageJson.version;
254893
+ var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
254894
+ function parse6(src) {
254895
+ const obj = {};
254896
+ let lines = src.toString();
254897
+ lines = lines.replace(/\r\n?/mg, "\n");
254898
+ let match2;
254899
+ while ((match2 = LINE.exec(lines)) != null) {
254900
+ const key = match2[1];
254901
+ let value = match2[2] || "";
254902
+ value = value.trim();
254903
+ const maybeQuote = value[0];
254904
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
254905
+ if (maybeQuote === '"') {
254906
+ value = value.replace(/\\n/g, "\n");
254907
+ value = value.replace(/\\r/g, "\r");
254908
+ }
254909
+ obj[key] = value;
254910
+ }
254911
+ return obj;
254912
+ }
254913
+ function _parseVault(options) {
254914
+ options = options || {};
254915
+ const vaultPath = _vaultPath(options);
254916
+ options.path = vaultPath;
254917
+ const result = DotenvModule.configDotenv(options);
254918
+ if (!result.parsed) {
254919
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
254920
+ err.code = "MISSING_DATA";
254921
+ throw err;
254922
+ }
254923
+ const keys2 = _dotenvKey(options).split(",");
254924
+ const length = keys2.length;
254925
+ let decrypted;
254926
+ for (let i3 = 0; i3 < length; i3++) {
254927
+ try {
254928
+ const key = keys2[i3].trim();
254929
+ const attrs = _instructions(result, key);
254930
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
254931
+ break;
254932
+ } catch (error2) {
254933
+ if (i3 + 1 >= length) {
254934
+ throw error2;
254935
+ }
254936
+ }
254937
+ }
254938
+ return DotenvModule.parse(decrypted);
254939
+ }
254940
+ function _warn(message) {
254941
+ console.log(`[dotenv@${version}][WARN] ${message}`);
254942
+ }
254943
+ function _debug(message) {
254944
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
254945
+ }
254946
+ function _log(message) {
254947
+ console.log(`[dotenv@${version}] ${message}`);
254948
+ }
254949
+ function _dotenvKey(options) {
254950
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
254951
+ return options.DOTENV_KEY;
254952
+ }
254953
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
254954
+ return process.env.DOTENV_KEY;
254955
+ }
254956
+ return "";
254957
+ }
254958
+ function _instructions(result, dotenvKey) {
254959
+ let uri;
254960
+ try {
254961
+ uri = new URL(dotenvKey);
254962
+ } catch (error2) {
254963
+ if (error2.code === "ERR_INVALID_URL") {
254964
+ 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");
254965
+ err.code = "INVALID_DOTENV_KEY";
254966
+ throw err;
254967
+ }
254968
+ throw error2;
254969
+ }
254970
+ const key = uri.password;
254971
+ if (!key) {
254972
+ const err = new Error("INVALID_DOTENV_KEY: Missing key part");
254973
+ err.code = "INVALID_DOTENV_KEY";
254974
+ throw err;
254975
+ }
254976
+ const environment = uri.searchParams.get("environment");
254977
+ if (!environment) {
254978
+ const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
254979
+ err.code = "INVALID_DOTENV_KEY";
254980
+ throw err;
254981
+ }
254982
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
254983
+ const ciphertext = result.parsed[environmentKey];
254984
+ if (!ciphertext) {
254985
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
254986
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
254987
+ throw err;
254988
+ }
254989
+ return { ciphertext, key };
254990
+ }
254991
+ function _vaultPath(options) {
254992
+ let possibleVaultPath = null;
254993
+ if (options && options.path && options.path.length > 0) {
254994
+ if (Array.isArray(options.path)) {
254995
+ for (const filepath of options.path) {
254996
+ if (fs6.existsSync(filepath)) {
254997
+ possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
254998
+ }
254999
+ }
255000
+ } else {
255001
+ possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
255002
+ }
255003
+ } else {
255004
+ possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
255005
+ }
255006
+ if (fs6.existsSync(possibleVaultPath)) {
255007
+ return possibleVaultPath;
255008
+ }
255009
+ return null;
255010
+ }
255011
+ function _resolveHome(envPath) {
255012
+ return envPath[0] === "~" ? path7.join(os3.homedir(), envPath.slice(1)) : envPath;
255013
+ }
255014
+ function _configVault(options) {
255015
+ const debug = Boolean(options && options.debug);
255016
+ const quiet = options && "quiet" in options ? options.quiet : true;
255017
+ if (debug || !quiet) {
255018
+ _log("Loading env from encrypted .env.vault");
255019
+ }
255020
+ const parsed = DotenvModule._parseVault(options);
255021
+ let processEnv = process.env;
255022
+ if (options && options.processEnv != null) {
255023
+ processEnv = options.processEnv;
255024
+ }
255025
+ DotenvModule.populate(processEnv, parsed, options);
255026
+ return { parsed };
255027
+ }
255028
+ function configDotenv(options) {
255029
+ const dotenvPath = path7.resolve(process.cwd(), ".env");
255030
+ let encoding = "utf8";
255031
+ const debug = Boolean(options && options.debug);
255032
+ const quiet = options && "quiet" in options ? options.quiet : true;
255033
+ if (options && options.encoding) {
255034
+ encoding = options.encoding;
255035
+ } else {
255036
+ if (debug) {
255037
+ _debug("No encoding is specified. UTF-8 is used by default");
255038
+ }
255039
+ }
255040
+ let optionPaths = [dotenvPath];
255041
+ if (options && options.path) {
255042
+ if (!Array.isArray(options.path)) {
255043
+ optionPaths = [_resolveHome(options.path)];
255044
+ } else {
255045
+ optionPaths = [];
255046
+ for (const filepath of options.path) {
255047
+ optionPaths.push(_resolveHome(filepath));
255048
+ }
255049
+ }
255050
+ }
255051
+ let lastError;
255052
+ const parsedAll = {};
255053
+ for (const path8 of optionPaths) {
255054
+ try {
255055
+ const parsed = DotenvModule.parse(fs6.readFileSync(path8, { encoding }));
255056
+ DotenvModule.populate(parsedAll, parsed, options);
255057
+ } catch (e3) {
255058
+ if (debug) {
255059
+ _debug(`Failed to load ${path8} ${e3.message}`);
255060
+ }
255061
+ lastError = e3;
255062
+ }
255063
+ }
255064
+ let processEnv = process.env;
255065
+ if (options && options.processEnv != null) {
255066
+ processEnv = options.processEnv;
255067
+ }
255068
+ DotenvModule.populate(processEnv, parsedAll, options);
255069
+ if (debug || !quiet) {
255070
+ const keysCount = Object.keys(parsedAll).length;
255071
+ const shortPaths = [];
255072
+ for (const filePath of optionPaths) {
255073
+ try {
255074
+ const relative = path7.relative(process.cwd(), filePath);
255075
+ shortPaths.push(relative);
255076
+ } catch (e3) {
255077
+ if (debug) {
255078
+ _debug(`Failed to load ${filePath} ${e3.message}`);
255079
+ }
255080
+ lastError = e3;
255081
+ }
255082
+ }
255083
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
255084
+ }
255085
+ if (lastError) {
255086
+ return { parsed: parsedAll, error: lastError };
255087
+ } else {
255088
+ return { parsed: parsedAll };
255089
+ }
255090
+ }
255091
+ function config(options) {
255092
+ if (_dotenvKey(options).length === 0) {
255093
+ return DotenvModule.configDotenv(options);
255094
+ }
255095
+ const vaultPath = _vaultPath(options);
255096
+ if (!vaultPath) {
255097
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
255098
+ return DotenvModule.configDotenv(options);
255099
+ }
255100
+ return DotenvModule._configVault(options);
255101
+ }
255102
+ function decrypt(encrypted, keyStr) {
255103
+ const key = Buffer.from(keyStr.slice(-64), "hex");
255104
+ let ciphertext = Buffer.from(encrypted, "base64");
255105
+ const nonce = ciphertext.subarray(0, 12);
255106
+ const authTag = ciphertext.subarray(-16);
255107
+ ciphertext = ciphertext.subarray(12, -16);
255108
+ try {
255109
+ const aesgcm = crypto2.createDecipheriv("aes-256-gcm", key, nonce);
255110
+ aesgcm.setAuthTag(authTag);
255111
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
255112
+ } catch (error2) {
255113
+ const isRange = error2 instanceof RangeError;
255114
+ const invalidKeyLength = error2.message === "Invalid key length";
255115
+ const decryptionFailed = error2.message === "Unsupported state or unable to authenticate data";
255116
+ if (isRange || invalidKeyLength) {
255117
+ const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
255118
+ err.code = "INVALID_DOTENV_KEY";
255119
+ throw err;
255120
+ } else if (decryptionFailed) {
255121
+ const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
255122
+ err.code = "DECRYPTION_FAILED";
255123
+ throw err;
255124
+ } else {
255125
+ throw error2;
255126
+ }
255127
+ }
255128
+ }
255129
+ function populate(processEnv, parsed, options = {}) {
255130
+ const debug = Boolean(options && options.debug);
255131
+ const override = Boolean(options && options.override);
255132
+ if (typeof parsed !== "object") {
255133
+ const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
255134
+ err.code = "OBJECT_REQUIRED";
255135
+ throw err;
255136
+ }
255137
+ for (const key of Object.keys(parsed)) {
255138
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
255139
+ if (override === true) {
255140
+ processEnv[key] = parsed[key];
255141
+ }
255142
+ if (debug) {
255143
+ if (override === true) {
255144
+ _debug(`"${key}" is already defined and WAS overwritten`);
255145
+ } else {
255146
+ _debug(`"${key}" is already defined and was NOT overwritten`);
255147
+ }
255148
+ }
255149
+ } else {
255150
+ processEnv[key] = parsed[key];
255151
+ }
255152
+ }
255153
+ }
255154
+ var DotenvModule = {
255155
+ configDotenv,
255156
+ _configVault,
255157
+ _parseVault,
255158
+ config,
255159
+ decrypt,
255160
+ parse: parse6,
255161
+ populate
255162
+ };
255163
+ module2.exports.configDotenv = DotenvModule.configDotenv;
255164
+ module2.exports._configVault = DotenvModule._configVault;
255165
+ module2.exports._parseVault = DotenvModule._parseVault;
255166
+ module2.exports.config = DotenvModule.config;
255167
+ module2.exports.decrypt = DotenvModule.decrypt;
255168
+ module2.exports.parse = DotenvModule.parse;
255169
+ module2.exports.populate = DotenvModule.populate;
255170
+ module2.exports = DotenvModule;
255171
+ }
255172
+ });
255173
+
254296
255174
  // src/directory-resolver.js
254297
255175
  async function getPackageBinDir() {
254298
255176
  const debug = process.env.DEBUG === "1" || process.env.VERBOSE === "1";
@@ -275759,7 +276637,7 @@ var require_uint32ArrayFrom = __commonJS({
275759
276637
  });
275760
276638
 
275761
276639
  // node_modules/@aws-crypto/util/build/main/index.js
275762
- var require_main = __commonJS({
276640
+ var require_main2 = __commonJS({
275763
276641
  "node_modules/@aws-crypto/util/build/main/index.js"(exports2) {
275764
276642
  "use strict";
275765
276643
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -275790,8 +276668,8 @@ var require_aws_crc32 = __commonJS({
275790
276668
  Object.defineProperty(exports2, "__esModule", { value: true });
275791
276669
  exports2.AwsCrc32 = void 0;
275792
276670
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
275793
- var util_1 = require_main();
275794
- var index_1 = require_main2();
276671
+ var util_1 = require_main2();
276672
+ var index_1 = require_main3();
275795
276673
  var AwsCrc32 = (
275796
276674
  /** @class */
275797
276675
  (function() {
@@ -275821,13 +276699,13 @@ var require_aws_crc32 = __commonJS({
275821
276699
  });
275822
276700
 
275823
276701
  // node_modules/@aws-crypto/crc32/build/main/index.js
275824
- var require_main2 = __commonJS({
276702
+ var require_main3 = __commonJS({
275825
276703
  "node_modules/@aws-crypto/crc32/build/main/index.js"(exports2) {
275826
276704
  "use strict";
275827
276705
  Object.defineProperty(exports2, "__esModule", { value: true });
275828
276706
  exports2.AwsCrc32 = exports2.Crc32 = exports2.crc32 = void 0;
275829
276707
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
275830
- var util_1 = require_main();
276708
+ var util_1 = require_main2();
275831
276709
  function crc32(data2) {
275832
276710
  return new Crc32().update(data2).digest();
275833
276711
  }
@@ -276133,7 +277011,7 @@ var require_main2 = __commonJS({
276133
277011
  var require_dist_cjs33 = __commonJS({
276134
277012
  "node_modules/@smithy/eventstream-codec/dist-cjs/index.js"(exports2) {
276135
277013
  "use strict";
276136
- var crc32 = require_main2();
277014
+ var crc32 = require_main3();
276137
277015
  var utilHexEncoding = require_dist_cjs17();
276138
277016
  var Int64 = class _Int64 {
276139
277017
  bytes;
@@ -278683,12 +279561,12 @@ var require_httpAuthSchemeProvider = __commonJS({
278683
279561
  });
278684
279562
 
278685
279563
  // node_modules/@aws-sdk/client-bedrock-runtime/package.json
278686
- var require_package = __commonJS({
279564
+ var require_package2 = __commonJS({
278687
279565
  "node_modules/@aws-sdk/client-bedrock-runtime/package.json"(exports2, module2) {
278688
279566
  module2.exports = {
278689
279567
  name: "@aws-sdk/client-bedrock-runtime",
278690
279568
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
278691
- version: "3.911.0",
279569
+ version: "3.913.0",
278692
279570
  scripts: {
278693
279571
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
278694
279572
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -278708,7 +279586,7 @@ var require_package = __commonJS({
278708
279586
  "@aws-crypto/sha256-browser": "5.2.0",
278709
279587
  "@aws-crypto/sha256-js": "5.2.0",
278710
279588
  "@aws-sdk/core": "3.911.0",
278711
- "@aws-sdk/credential-provider-node": "3.911.0",
279589
+ "@aws-sdk/credential-provider-node": "3.913.0",
278712
279590
  "@aws-sdk/eventstream-handler-node": "3.910.0",
278713
279591
  "@aws-sdk/middleware-eventstream": "3.910.0",
278714
279592
  "@aws-sdk/middleware-host-header": "3.910.0",
@@ -280917,7 +281795,7 @@ var require_httpAuthSchemeProvider2 = __commonJS({
280917
281795
  });
280918
281796
 
280919
281797
  // node_modules/@aws-sdk/client-sso/package.json
280920
- var require_package2 = __commonJS({
281798
+ var require_package3 = __commonJS({
280921
281799
  "node_modules/@aws-sdk/client-sso/package.json"(exports2, module2) {
280922
281800
  module2.exports = {
280923
281801
  name: "@aws-sdk/client-sso",
@@ -281132,7 +282010,7 @@ var require_runtimeConfig = __commonJS({
281132
282010
  Object.defineProperty(exports2, "__esModule", { value: true });
281133
282011
  exports2.getRuntimeConfig = void 0;
281134
282012
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
281135
- var package_json_1 = tslib_1.__importDefault(require_package2());
282013
+ var package_json_1 = tslib_1.__importDefault(require_package3());
281136
282014
  var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
281137
282015
  var util_user_agent_node_1 = require_dist_cjs51();
281138
282016
  var config_resolver_1 = require_dist_cjs39();
@@ -283366,7 +284244,7 @@ var require_dist_cjs61 = __commonJS({
283366
284244
  }
283367
284245
  return withProviderProfile;
283368
284246
  };
283369
- var resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}) => {
284247
+ var resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}, resolveProfileData2) => {
283370
284248
  options.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
283371
284249
  const profileData = profiles[profileName];
283372
284250
  const { source_profile, region } = profileData;
@@ -283385,7 +284263,7 @@ var require_dist_cjs61 = __commonJS({
283385
284263
  throw new propertyProvider.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${sharedIniFileLoader.getProfileName(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), { logger: options.logger });
283386
284264
  }
283387
284265
  options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
283388
- const sourceCredsProvider = source_profile ? resolveProfileData(source_profile, profiles, options, {
284266
+ const sourceCredsProvider = source_profile ? resolveProfileData2(source_profile, profiles, options, {
283389
284267
  ...visitedProfiles,
283390
284268
  [source_profile]: true
283391
284269
  }, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {})) : (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
@@ -283461,7 +284339,7 @@ var require_dist_cjs61 = __commonJS({
283461
284339
  return resolveStaticCredentials(data2, options);
283462
284340
  }
283463
284341
  if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data2, { profile: profileName, logger: options.logger })) {
283464
- return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles);
284342
+ return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles, resolveProfileData);
283465
284343
  }
283466
284344
  if (isStaticCredsProfile(data2)) {
283467
284345
  return resolveStaticCredentials(data2, options);
@@ -283853,7 +284731,7 @@ var require_runtimeConfig2 = __commonJS({
283853
284731
  Object.defineProperty(exports2, "__esModule", { value: true });
283854
284732
  exports2.getRuntimeConfig = void 0;
283855
284733
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
283856
- var package_json_1 = tslib_1.__importDefault(require_package());
284734
+ var package_json_1 = tslib_1.__importDefault(require_package2());
283857
284735
  var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2));
283858
284736
  var credential_provider_node_1 = require_dist_cjs62();
283859
284737
  var eventstream_handler_node_1 = require_dist_cjs63();
@@ -308347,8 +309225,8 @@ var init_parser2 = __esm({
308347
309225
  { ALT: () => this.CONSUME(Identifier) },
308348
309226
  { ALT: () => this.CONSUME(Text) },
308349
309227
  { ALT: () => this.CONSUME(NumberLiteral) },
308350
- { ALT: () => this.CONSUME(RoundOpen) },
308351
- { ALT: () => this.CONSUME(RoundClose) },
309228
+ // Note: RoundOpen and RoundClose (parentheses) are NOT allowed in unquoted labels
309229
+ // to match Mermaid's behavior - use quoted labels like ["text (with parens)"] instead
308352
309230
  // Allow HTML-like tags (e.g., <br/>) inside labels
308353
309231
  { ALT: () => this.CONSUME(AngleLess) },
308354
309232
  { ALT: () => this.CONSUME(AngleOpen) },
@@ -308437,7 +309315,17 @@ var init_parser2 = __esm({
308437
309315
  this.OR([
308438
309316
  { ALT: () => this.CONSUME(Identifier) },
308439
309317
  { ALT: () => this.CONSUME(Text) },
308440
- { ALT: () => this.CONSUME(NumberLiteral) }
309318
+ { ALT: () => this.CONSUME(NumberLiteral) },
309319
+ // Allow HTML-like angle brackets and slashes for <br/>, <i>, etc.
309320
+ { ALT: () => this.CONSUME(AngleLess) },
309321
+ { ALT: () => this.CONSUME(AngleOpen) },
309322
+ { ALT: () => this.CONSUME(ForwardSlash) },
309323
+ { ALT: () => this.CONSUME(Backslash) },
309324
+ // Allow common punctuation seen in labels
309325
+ { ALT: () => this.CONSUME(Comma) },
309326
+ { ALT: () => this.CONSUME(Colon) },
309327
+ { ALT: () => this.CONSUME(Ampersand) },
309328
+ { ALT: () => this.CONSUME(Semicolon) }
308441
309329
  ]);
308442
309330
  });
308443
309331
  });
@@ -309049,7 +309937,7 @@ var init_semantics = __esm({
309049
309937
  this.ctx.errors.push({
309050
309938
  line: q3.startLine ?? 1,
309051
309939
  column: col,
309052
- severity: "warning",
309940
+ severity: "error",
309053
309941
  code: "FL-LABEL-CURLY-IN-QUOTED",
309054
309942
  message: "Curly braces inside quoted label text may be parsed as a shape by Mermaid. Replace { and } with HTML entities.",
309055
309943
  hint: 'Use &#123; and &#125; for { and } inside quoted text, e.g., "tyk-trace-&#123;id&#125;".',
@@ -309179,6 +310067,8 @@ var init_semantics = __esm({
309179
310067
  this.ctx.errors.push({
309180
310068
  line: tk.startLine ?? 1,
309181
310069
  column: col,
310070
+ // Treat backticks in quoted labels as errors (CLI rejects in many cases);
310071
+ // outside quotes, surface as a warning.
309182
310072
  severity: inQuoted ? "error" : "warning",
309183
310073
  code: "FL-LABEL-BACKTICK",
309184
310074
  message: "Backticks (`\u2026`) inside node labels are not supported by Mermaid.",
@@ -310463,7 +311353,7 @@ function validateFlowchart(text, options = {}) {
310463
311353
  code: "FL-LABEL-ESCAPED-QUOTE",
310464
311354
  message: 'Escaped quotes (\\") in node labels are accepted by Mermaid, but using &quot; is preferred for portability.',
310465
311355
  hint: 'Prefer &quot; inside quoted labels, e.g., A["He said &quot;Hi&quot;"]'
310466
- }).map((e3) => ({ ...e3, severity: "warning" }));
311356
+ }).map((e3) => ({ ...e3, severity: "error" }));
310467
311357
  const seenDoubleLines = new Set(prevErrors.filter((e3) => e3.code === "FL-LABEL-DOUBLE-IN-DOUBLE").map((e3) => e3.line));
310468
311358
  const escapedLinesAll = new Set(detectEscapedQuotes(tokens, { code: "x" }).map((e3) => e3.line));
310469
311359
  const dbl = detectDoubleInDouble(tokens, {
@@ -312742,11 +313632,85 @@ function computeFixes(text, errors, level = "safe") {
312742
313632
  const patchedLines = /* @__PURE__ */ new Set();
312743
313633
  const seen = /* @__PURE__ */ new Set();
312744
313634
  const piQuoteClosedLines = /* @__PURE__ */ new Set();
313635
+ function sanitizeAllQuotedSegmentsInShapes(lineText, lineNo) {
313636
+ const shapes = [
313637
+ { open: "[[", close: "]]" },
313638
+ { open: "((", close: "))" },
313639
+ { open: "{{", close: "}}" },
313640
+ { open: "[(", close: ")]" },
313641
+ { open: "([", close: "])" },
313642
+ { open: "{", close: "}" },
313643
+ { open: "[", close: "]" },
313644
+ { open: "(", close: ")" }
313645
+ ];
313646
+ let idx = 0;
313647
+ let produced = 0;
313648
+ while (idx < lineText.length) {
313649
+ let found = null;
313650
+ for (const s3 of shapes) {
313651
+ const i3 = lineText.indexOf(s3.open, idx);
313652
+ if (i3 !== -1 && (found === null || i3 < found.i))
313653
+ found = { ...s3, i: i3 };
313654
+ }
313655
+ if (!found)
313656
+ break;
313657
+ const contentStart = found.i + found.open.length;
313658
+ const closeIdx = lineText.indexOf(found.close, contentStart);
313659
+ if (closeIdx === -1) {
313660
+ idx = contentStart;
313661
+ continue;
313662
+ }
313663
+ let q1 = -1;
313664
+ for (let i3 = contentStart; i3 < closeIdx; i3++) {
313665
+ if (lineText[i3] === '"' && lineText[i3 - 1] !== "\\") {
313666
+ q1 = i3;
313667
+ break;
313668
+ }
313669
+ }
313670
+ if (q1 !== -1) {
313671
+ let q22 = -1;
313672
+ for (let j3 = closeIdx - 1; j3 > q1; j3--) {
313673
+ if (lineText[j3] === '"' && lineText[j3 - 1] !== "\\") {
313674
+ q22 = j3;
313675
+ break;
313676
+ }
313677
+ }
313678
+ if (q22 !== -1) {
313679
+ const inner = lineText.slice(q1 + 1, q22);
313680
+ const replaced = sanitizeQuotedInner(inner);
313681
+ if (replaced !== inner) {
313682
+ edits.push({ start: { line: lineNo, column: q1 + 2 }, end: { line: lineNo, column: q22 + 1 }, newText: replaced });
313683
+ produced++;
313684
+ }
313685
+ }
313686
+ }
313687
+ idx = closeIdx + found.close.length;
313688
+ }
313689
+ return produced;
313690
+ }
313691
+ function sanitizeQuotedInner(inner) {
313692
+ const SENT_Q = "\0__Q__";
313693
+ let out = inner.split("&quot;").join(SENT_Q);
313694
+ out = out.replace(/`/g, "");
313695
+ out = out.replace(/\\\"/g, "&quot;");
313696
+ out = out.replace(/\"/g, "&quot;");
313697
+ out = out.replace(/"/g, "&quot;");
313698
+ out = out.split(SENT_Q).join("&quot;");
313699
+ return out;
313700
+ }
312745
313701
  for (const e3 of errors) {
312746
313702
  const key = `${e3.code}@${e3.line}:${e3.column}:${e3.length ?? 1}`;
312747
313703
  if (seen.has(key))
312748
313704
  continue;
312749
313705
  seen.add(key);
313706
+ if ((e3.code === "FL-LABEL-ESCAPED-QUOTE" || e3.code === "FL-LABEL-CURLY-IN-QUOTED" || e3.code === "FL-LABEL-DOUBLE-IN-DOUBLE" || e3.code === "FL-LABEL-BACKTICK") && !patchedLines.has(e3.line)) {
313707
+ const lineText = lineTextAt(text, e3.line);
313708
+ const produced = sanitizeAllQuotedSegmentsInShapes(lineText, e3.line);
313709
+ patchedLines.add(e3.line);
313710
+ if (produced > 0) {
313711
+ continue;
313712
+ }
313713
+ }
312750
313714
  if (is("FL-ARROW-INVALID", e3)) {
312751
313715
  edits.push(replaceRange(text, at(e3), e3.length ?? 2, "-->"));
312752
313716
  continue;
@@ -312851,6 +313815,8 @@ function computeFixes(text, errors, level = "safe") {
312851
313815
  continue;
312852
313816
  }
312853
313817
  if (is("FL-LABEL-ESCAPED-QUOTE", e3)) {
313818
+ if (patchedLines.has(e3.line))
313819
+ continue;
312854
313820
  const lineText = lineTextAt(text, e3.line);
312855
313821
  const caret0 = Math.max(0, e3.column - 1);
312856
313822
  const opens = [
@@ -312873,17 +313839,10 @@ function computeFixes(text, errors, level = "safe") {
312873
313839
  const q22 = lineText.lastIndexOf('"', closeIdx - 1);
312874
313840
  if (q1 !== -1 && q22 !== -1 && q22 > q1) {
312875
313841
  const inner = lineText.slice(q1 + 1, q22);
312876
- if (inner.includes('\\"')) {
312877
- const replaced = inner.split('\\"').join("&quot;");
313842
+ const replaced = sanitizeQuotedInner(inner);
313843
+ if (replaced !== inner) {
312878
313844
  edits.push({ start: { line: e3.line, column: q1 + 2 }, end: { line: e3.line, column: q22 + 1 }, newText: replaced });
312879
313845
  continue;
312880
- if (is("FL-META-UNSUPPORTED", e3)) {
312881
- if (level === "all") {
312882
- const lineText2 = lineTextAt(text, e3.line);
312883
- edits.push({ start: { line: e3.line, column: 1 }, end: { line: e3.line + 1, column: 1 }, newText: "" });
312884
- }
312885
- continue;
312886
- }
312887
313846
  }
312888
313847
  }
312889
313848
  }
@@ -312893,11 +313852,12 @@ function computeFixes(text, errors, level = "safe") {
312893
313852
  }
312894
313853
  if (is("FL-META-UNSUPPORTED", e3)) {
312895
313854
  if (level === "all") {
313855
+ const lineText = lineTextAt(text, e3.line);
312896
313856
  edits.push({ start: { line: e3.line, column: 1 }, end: { line: e3.line + 1, column: 1 }, newText: "" });
312897
313857
  }
312898
313858
  continue;
312899
313859
  }
312900
- if (is("FL-LABEL-BACKTICK", e3)) {
313860
+ if (is("FL-LABEL-BACKTICK", e3) && e3.severity === "warning") {
312901
313861
  edits.push(replaceRange(text, at(e3), e3.length ?? 1, ""));
312902
313862
  continue;
312903
313863
  }
@@ -312907,13 +313867,13 @@ function computeFixes(text, errors, level = "safe") {
312907
313867
  let qOpenIdx = -1;
312908
313868
  let qChar = null;
312909
313869
  for (let i3 = caret0; i3 >= 0; i3--) {
312910
- const ch2 = lineText[i3];
312911
- const code = ch2 ? ch2.charCodeAt(0) : -1;
313870
+ const ch = lineText[i3];
313871
+ const code = ch ? ch.charCodeAt(0) : -1;
312912
313872
  if (code === 34 || code === 39) {
312913
313873
  const bs = i3 > 0 && lineText[i3 - 1] === "\\";
312914
313874
  if (!bs) {
312915
313875
  qOpenIdx = i3;
312916
- qChar = ch2;
313876
+ qChar = ch;
312917
313877
  break;
312918
313878
  }
312919
313879
  }
@@ -312921,8 +313881,8 @@ function computeFixes(text, errors, level = "safe") {
312921
313881
  if (qOpenIdx !== -1 && qChar) {
312922
313882
  let qCloseIdx = -1;
312923
313883
  for (let j3 = qOpenIdx + 1; j3 < lineText.length; j3++) {
312924
- const ch2 = lineText[j3];
312925
- const code = ch2 ? ch2.charCodeAt(0) : -1;
313884
+ const ch = lineText[j3];
313885
+ const code = ch ? ch.charCodeAt(0) : -1;
312926
313886
  if (code === (qChar ? qChar.charCodeAt(0) : -1)) {
312927
313887
  const bs = lineText[j3 - 1] === "\\";
312928
313888
  if (!bs) {
@@ -312933,17 +313893,13 @@ function computeFixes(text, errors, level = "safe") {
312933
313893
  }
312934
313894
  if (qCloseIdx > qOpenIdx) {
312935
313895
  const inner = lineText.slice(qOpenIdx + 1, qCloseIdx);
312936
- const replaced = inner.replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
313896
+ const replaced = sanitizeQuotedInner(inner);
312937
313897
  if (replaced !== inner) {
312938
313898
  edits.push({ start: { line: e3.line, column: qOpenIdx + 2 }, end: { line: e3.line, column: qCloseIdx + 1 }, newText: replaced });
312939
313899
  continue;
312940
313900
  }
312941
313901
  }
312942
313902
  }
312943
- const ch = lineText[caret0] || "";
312944
- const rep = ch === "{" ? "&#123;" : ch === "}" ? "&#125;" : ch;
312945
- if (rep !== ch)
312946
- edits.push(replaceRange(text, at(e3), e3.length ?? 1, rep));
312947
313903
  continue;
312948
313904
  }
312949
313905
  if (is("FL-END-WITHOUT-SUBGRAPH", e3)) {
@@ -312955,6 +313911,11 @@ function computeFixes(text, errors, level = "safe") {
312955
313911
  if (is("FL-LABEL-DOUBLE-IN-DOUBLE", e3)) {
312956
313912
  const lineText = lineTextAt(text, e3.line);
312957
313913
  const caret0 = Math.max(0, e3.column - 1);
313914
+ const rawDqCount = (lineText.match(/\"/g) || []).length;
313915
+ const unescapedDqCount = (lineText.replace(/\\\"/g, "").match(/\"/g) || []).length;
313916
+ if (rawDqCount + unescapedDqCount > 8 && level !== "all") {
313917
+ continue;
313918
+ }
312958
313919
  const opens = [
312959
313920
  { tok: "[[", idx: lineText.lastIndexOf("[[", caret0) },
312960
313921
  { tok: "((", idx: lineText.lastIndexOf("((", caret0) },
@@ -312978,7 +313939,7 @@ function computeFixes(text, errors, level = "safe") {
312978
313939
  const q22 = lineText.lastIndexOf('"', closeIdx - 1);
312979
313940
  if (q1 !== -1 && q22 !== -1 && q22 > q1) {
312980
313941
  const inner = lineText.slice(q1 + 1, q22);
312981
- const replaced = inner.split("&quot;").join("\0").split('"').join("&quot;").split("\0").join("&quot;");
313942
+ const replaced = sanitizeQuotedInner(inner);
312982
313943
  if (replaced !== inner) {
312983
313944
  const start = { line: e3.line, column: q1 + 2 };
312984
313945
  const end = { line: e3.line, column: q22 + 1 };
@@ -313340,6 +314301,10 @@ function computeFixes(text, errors, level = "safe") {
313340
314301
  if (level === "safe" || level === "all") {
313341
314302
  const lineText = lineTextAt(text, e3.line);
313342
314303
  const caret0 = Math.max(0, e3.column - 1);
314304
+ const dq = (lineText.replace(/\\\"/g, "").match(/\"/g) || []).length;
314305
+ if (lineText.length > 600 || dq > 8) {
314306
+ continue;
314307
+ }
313343
314308
  const openPairs = [
313344
314309
  { open: "[[", close: "]]", idx: lineText.lastIndexOf("[[", caret0), delta: 2 },
313345
314310
  { open: "((", close: "))", idx: lineText.lastIndexOf("((", caret0), delta: 2 },
@@ -313390,6 +314355,24 @@ function computeFixes(text, errors, level = "safe") {
313390
314355
  { open: "[", close: "]" },
313391
314356
  { open: "(", close: ")" }
313392
314357
  ];
314358
+ const findMatchingCloser = (text2, openIdx, opener, closer) => {
314359
+ let pos = openIdx + opener.length;
314360
+ let depth = 1;
314361
+ while (pos < text2.length && depth > 0) {
314362
+ if (text2.slice(pos, pos + opener.length) === opener) {
314363
+ depth++;
314364
+ pos += opener.length;
314365
+ } else if (text2.slice(pos, pos + closer.length) === closer) {
314366
+ depth--;
314367
+ if (depth === 0)
314368
+ return pos;
314369
+ pos += closer.length;
314370
+ } else {
314371
+ pos++;
314372
+ }
314373
+ }
314374
+ return -1;
314375
+ };
313393
314376
  for (const shape of shapes) {
313394
314377
  let searchStart = 0;
313395
314378
  while (true) {
@@ -313397,7 +314380,7 @@ function computeFixes(text, errors, level = "safe") {
313397
314380
  if (openIdx === -1)
313398
314381
  break;
313399
314382
  const contentStart = openIdx + shape.open.length;
313400
- const closeIdx = lineText.indexOf(shape.close, contentStart);
314383
+ const closeIdx = shape.open === "(" && shape.close === ")" ? findMatchingCloser(lineText, openIdx, shape.open, shape.close) : lineText.indexOf(shape.close, contentStart);
313401
314384
  if (closeIdx === -1)
313402
314385
  break;
313403
314386
  if (openIdx <= caret0 && caret0 < closeIdx) {
@@ -313415,10 +314398,11 @@ function computeFixes(text, errors, level = "safe") {
313415
314398
  const left = core.slice(0, 1);
313416
314399
  const right = core.slice(-1);
313417
314400
  const isSlashPair = (l3, r3) => l3 === "/" && r3 === "/" || l3 === "\\" && r3 === "\\" || l3 === "/" && r3 === "\\" || l3 === "\\" && r3 === "/";
313418
- if (core.length >= 2 && isSlashPair(left, right)) {
313419
- break;
314401
+ const isParallelogramShape = core.length >= 2 && isSlashPair(left, right);
314402
+ let replaced = inner.replace(/\(/g, "&#40;").replace(/\)/g, "&#41;");
314403
+ if (isParallelogramShape) {
314404
+ replaced = replaced.replace(/"/g, "&quot;");
313420
314405
  }
313421
- const replaced = inner.replace(/\(/g, "&#40;").replace(/\)/g, "&#41;");
313422
314406
  if (replaced !== inner) {
313423
314407
  edits.push({ start: { line: e3.line, column: contentStart + 1 }, end: { line: e3.line, column: closeIdx + 1 }, newText: replaced });
313424
314408
  patchedLines.add(e3.line);
@@ -323538,7 +324522,7 @@ ${baseGroup}
323538
324522
  return out;
323539
324523
  }
323540
324524
  htmlDecode(s3) {
323541
- return s3.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
324525
+ return s3.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#96;/g, "`").replace(/&#123;/g, "{").replace(/&#125;/g, "}").replace(/&#40;/g, "(").replace(/&#41;/g, ")");
323542
324526
  }
323543
324527
  generateEdge(edge, padX, padY, nodeMap) {
323544
324528
  if (!edge.points || edge.points.length < 2) {
@@ -328247,10 +329231,11 @@ var ProbeAgent_exports = {};
328247
329231
  __export(ProbeAgent_exports, {
328248
329232
  ProbeAgent: () => ProbeAgent
328249
329233
  });
328250
- var import_anthropic, import_openai, import_google, import_ai3, import_crypto5, import_events2, import_fs7, import_promises2, import_path9, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, SUPPORTED_IMAGE_EXTENSIONS, MAX_IMAGE_FILE_SIZE, ProbeAgent;
329234
+ var import_dotenv, import_anthropic, import_openai, import_google, import_ai3, import_crypto5, import_events2, import_fs7, import_promises2, import_path9, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, SUPPORTED_IMAGE_EXTENSIONS, MAX_IMAGE_FILE_SIZE, ProbeAgent;
328251
329235
  var init_ProbeAgent = __esm({
328252
329236
  "src/agent/ProbeAgent.js"() {
328253
329237
  "use strict";
329238
+ import_dotenv = __toESM(require_main(), 1);
328254
329239
  import_anthropic = __nccwpck_require__(93201);
328255
329240
  import_openai = __nccwpck_require__(87635);
328256
329241
  import_google = __nccwpck_require__(30260);
@@ -328272,6 +329257,7 @@ var init_ProbeAgent = __esm({
328272
329257
  init_schemaUtils();
328273
329258
  init_xmlParsingUtils();
328274
329259
  init_mcp();
329260
+ import_dotenv.default.config();
328275
329261
  MAX_TOOL_ITERATIONS = parseInt(process.env.MAX_TOOL_ITERATIONS || "30", 10);
328276
329262
  MAX_HISTORY_MESSAGES = 100;
328277
329263
  SUPPORTED_IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "bmp", "svg"];
@@ -331120,8 +332106,10 @@ __export(index_exports, {
331120
332106
  tools: () => tools_exports
331121
332107
  });
331122
332108
  module.exports = __toCommonJS(index_exports);
332109
+ var import_dotenv2;
331123
332110
  var init_index = __esm({
331124
332111
  "src/index.js"() {
332112
+ import_dotenv2 = __toESM(require_main(), 1);
331125
332113
  init_search();
331126
332114
  init_query();
331127
332115
  init_extract();
@@ -331141,6 +332129,7 @@ var init_index = __esm({
331141
332129
  init_probeTool();
331142
332130
  init_storage();
331143
332131
  init_hooks();
332132
+ import_dotenv2.default.config();
331144
332133
  }
331145
332134
  });
331146
332135
  init_index();
@@ -360716,6 +361705,14 @@ module.exports = /*#__PURE__*/JSON.parse('{"$schema":"http://json-schema.org/dra
360716
361705
 
360717
361706
  /***/ }),
360718
361707
 
361708
+ /***/ 80056:
361709
+ /***/ ((module) => {
361710
+
361711
+ "use strict";
361712
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"dotenv","version":"17.2.3","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}');
361713
+
361714
+ /***/ }),
361715
+
360719
361716
  /***/ 17324:
360720
361717
  /***/ ((module) => {
360721
361718
 
@@ -360784,7 +361781,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"assert":true,"node:assert":[">= 14.1
360784
361781
  /***/ ((module) => {
360785
361782
 
360786
361783
  "use strict";
360787
- module.exports = {"rE":"0.1.95"};
361784
+ module.exports = {"rE":"0.1.96"};
360788
361785
 
360789
361786
  /***/ })
360790
361787