@catbee/utils 2.0.0-next.1 → 2.0.1
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/LICENSE +1 -1
- package/README.md +55 -38
- package/array/index.cjs +37 -5
- package/array/index.d.ts +59 -8
- package/array/index.mjs +32 -4
- package/async/index.cjs +24 -3
- package/async/index.d.ts +18 -2
- package/async/index.mjs +24 -4
- package/cache/index.cjs +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.mjs +1 -1
- package/config/index.cjs +8 -8
- package/config/index.d.ts +1 -1
- package/config/index.mjs +4 -4
- package/context-store/index.cjs +2 -3
- package/context-store/index.d.ts +1 -1
- package/context-store/index.mjs +2 -3
- package/crypto/index.cjs +55 -5
- package/crypto/index.d.ts +63 -2
- package/crypto/index.mjs +52 -7
- package/date/index.cjs +630 -1
- package/date/index.d.ts +487 -2
- package/date/index.mjs +621 -2
- package/{decorators → decorator}/index.cjs +425 -304
- package/{decorators → decorator}/index.d.ts +3 -2
- package/{decorators → decorator}/index.mjs +425 -304
- package/{dir → directory}/index.cjs +1 -1
- package/{dir → directory}/index.d.ts +1 -1
- package/{dir → directory}/index.mjs +1 -1
- package/env/index.cjs +90 -42
- package/env/index.d.ts +12 -1
- package/env/index.mjs +90 -42
- package/exception/index.cjs +1 -1
- package/exception/index.d.ts +1 -1
- package/exception/index.mjs +1 -1
- package/fs/index.cjs +1 -1
- package/fs/index.d.ts +1 -1
- package/fs/index.mjs +1 -1
- package/http-status-codes/index.cjs +1 -1
- package/http-status-codes/index.d.ts +1 -1
- package/http-status-codes/index.mjs +1 -1
- package/id/index.cjs +1 -1
- package/id/index.d.ts +1 -1
- package/id/index.mjs +1 -1
- package/index.cjs +10 -10
- package/index.d.ts +4 -4
- package/index.mjs +4 -4
- package/logger/index.cjs +2 -4
- package/logger/index.d.ts +2 -2
- package/logger/index.mjs +2 -4
- package/middleware/index.cjs +1 -1
- package/middleware/index.d.ts +1 -1
- package/middleware/index.mjs +1 -1
- package/{obj → object}/index.cjs +182 -108
- package/{obj → object}/index.d.ts +38 -2
- package/{obj → object}/index.mjs +180 -109
- package/package.json +31 -13
- package/performance/index.cjs +2 -2
- package/performance/index.d.ts +1 -1
- package/performance/index.mjs +2 -2
- package/request/index.cjs +36 -24
- package/request/index.d.ts +1 -1
- package/request/index.mjs +36 -24
- package/response/index.cjs +1 -1
- package/response/index.d.ts +1 -1
- package/response/index.mjs +1 -1
- package/server/index.cjs +233 -131
- package/server/index.d.ts +81 -1
- package/server/index.mjs +229 -127
- package/stream/index.cjs +1 -1
- package/stream/index.d.ts +1 -1
- package/stream/index.mjs +1 -1
- package/string/index.cjs +34 -1
- package/string/index.d.ts +45 -2
- package/string/index.mjs +31 -2
- package/type/index.cjs +18 -1
- package/type/index.d.ts +38 -2
- package/type/index.mjs +16 -2
- package/types/index.cjs +1 -1
- package/types/index.d.ts +10 -3
- package/types/index.mjs +1 -1
- package/url/index.cjs +61 -1
- package/url/index.d.ts +59 -2
- package/url/index.mjs +57 -2
- package/validation/index.cjs +3 -3
- package/validation/index.d.ts +1 -1
- package/validation/index.mjs +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/env/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -85,9 +85,7 @@ var Env = class _Env {
|
|
|
85
85
|
static set(key, value) {
|
|
86
86
|
process.env[key] = value;
|
|
87
87
|
this.cache.delete(key);
|
|
88
|
-
for (const cacheKey of
|
|
89
|
-
...this.cache.keys()
|
|
90
|
-
]) {
|
|
88
|
+
for (const cacheKey of this.cache.keys()) {
|
|
91
89
|
if (cacheKey.includes(`:${key}`)) {
|
|
92
90
|
this.cache.delete(cacheKey);
|
|
93
91
|
}
|
|
@@ -441,20 +439,33 @@ var Env = class _Env {
|
|
|
441
439
|
if (!value) {
|
|
442
440
|
throw new Error(`URL environment variable '${key}' is missing or empty`);
|
|
443
441
|
}
|
|
444
|
-
|
|
442
|
+
const url = this.parseUrl(value, key);
|
|
443
|
+
this.validateProtocol(url, key, options);
|
|
444
|
+
this.validateHostname(url, key, options);
|
|
445
|
+
this.cache.set(cacheKey, value);
|
|
446
|
+
return value;
|
|
447
|
+
}
|
|
448
|
+
static parseUrl(value, key) {
|
|
445
449
|
try {
|
|
446
|
-
|
|
450
|
+
return new URL(value);
|
|
447
451
|
} catch {
|
|
448
452
|
throw new Error(`Environment variable '${key}' is not a valid URL: "${value}"`);
|
|
449
453
|
}
|
|
454
|
+
}
|
|
455
|
+
static validateProtocol(url, key, options) {
|
|
450
456
|
if (options.protocols && options.protocols.length > 0) {
|
|
451
457
|
const protocol = url.protocol.replace(":", "");
|
|
452
458
|
if (!options.protocols.includes(protocol)) {
|
|
453
459
|
throw new Error(`Environment variable '${key}' must use one of the protocols: ${options.protocols.join(", ")}. Got: ${protocol}`);
|
|
454
460
|
}
|
|
455
461
|
}
|
|
462
|
+
}
|
|
463
|
+
static isIp(hostname) {
|
|
464
|
+
return /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(hostname);
|
|
465
|
+
}
|
|
466
|
+
static validateHostname(url, key, options) {
|
|
456
467
|
const { hostname } = url;
|
|
457
|
-
const isIp =
|
|
468
|
+
const isIp = _Env.isIp(hostname);
|
|
458
469
|
const isLocalhost = hostname === "localhost";
|
|
459
470
|
if (isIp && options.allowIp === false) {
|
|
460
471
|
throw new Error(`Environment variable '${key}' cannot be an IP address: "${hostname}"`);
|
|
@@ -467,8 +478,6 @@ var Env = class _Env {
|
|
|
467
478
|
throw new Error(`Environment variable '${key}' must have a valid host with TLD: "${hostname}"`);
|
|
468
479
|
}
|
|
469
480
|
}
|
|
470
|
-
this.cache.set(cacheKey, value);
|
|
471
|
-
return value;
|
|
472
481
|
}
|
|
473
482
|
/**
|
|
474
483
|
* Retrieves an email environment variable and validates it.
|
|
@@ -651,63 +660,102 @@ var Env = class _Env {
|
|
|
651
660
|
throw new Error(`Environment file not found: "${path}"`);
|
|
652
661
|
}
|
|
653
662
|
const content = fs.readFileSync(path, "utf8");
|
|
663
|
+
const variables = this.parseEnvContent(content);
|
|
664
|
+
for (const [k, v] of Object.entries(variables)) {
|
|
665
|
+
if (!process.env[k]) {
|
|
666
|
+
process.env[k] = v;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return variables;
|
|
670
|
+
}
|
|
671
|
+
static parseEnvContent(content) {
|
|
654
672
|
const variables = {};
|
|
655
673
|
const lines = content.split(/\r?\n/);
|
|
656
674
|
let i = 0;
|
|
657
675
|
while (i < lines.length) {
|
|
658
676
|
let line = lines[i].trim();
|
|
659
|
-
if (
|
|
677
|
+
if (this.isCommentOrEmpty(line)) {
|
|
660
678
|
i++;
|
|
661
679
|
continue;
|
|
662
680
|
}
|
|
663
|
-
const match =
|
|
681
|
+
const match = this.extractKeyValue(line);
|
|
664
682
|
if (!match) {
|
|
665
683
|
i++;
|
|
666
684
|
continue;
|
|
667
685
|
}
|
|
668
686
|
const key = match[1].trim();
|
|
669
687
|
let value = match[2].trim();
|
|
670
|
-
if (
|
|
671
|
-
|
|
672
|
-
if (hashIndex !== -1) {
|
|
673
|
-
value = value.slice(0, hashIndex).trim();
|
|
674
|
-
}
|
|
688
|
+
if (!this.isQuoted(value)) {
|
|
689
|
+
value = this.stripInlineComment(value);
|
|
675
690
|
}
|
|
676
|
-
if (
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
i++;
|
|
681
|
-
while (i < lines.length) {
|
|
682
|
-
const nextLine = lines[i];
|
|
683
|
-
if (nextLine.endsWith(quote)) {
|
|
684
|
-
multilineValue += "\n" + nextLine.slice(0, -1);
|
|
685
|
-
break;
|
|
686
|
-
} else {
|
|
687
|
-
multilineValue += "\n" + nextLine;
|
|
688
|
-
}
|
|
689
|
-
i++;
|
|
690
|
-
}
|
|
691
|
-
value = multilineValue;
|
|
692
|
-
} else {
|
|
693
|
-
value = value.slice(1, -1);
|
|
694
|
-
}
|
|
691
|
+
if (this.isQuoted(value) && value.length > 1) {
|
|
692
|
+
const result = this.parseQuotedValue(lines, i, value);
|
|
693
|
+
value = result.value;
|
|
694
|
+
i = result.nextIndex;
|
|
695
695
|
} else {
|
|
696
|
-
i
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
i++;
|
|
700
|
-
}
|
|
701
|
-
i--;
|
|
696
|
+
const result = this.parseUnquotedMultiline(lines, i, value);
|
|
697
|
+
value = result.value;
|
|
698
|
+
i = result.nextIndex;
|
|
702
699
|
}
|
|
703
700
|
if (!process.env[key]) {
|
|
704
|
-
process.env[key] = value;
|
|
705
701
|
variables[key] = value;
|
|
706
702
|
}
|
|
707
703
|
i++;
|
|
708
704
|
}
|
|
709
705
|
return variables;
|
|
710
706
|
}
|
|
707
|
+
static isCommentOrEmpty(line) {
|
|
708
|
+
return !line || line.startsWith("#");
|
|
709
|
+
}
|
|
710
|
+
static extractKeyValue(line) {
|
|
711
|
+
return line.match(/^([^=]+)=(.*)$/);
|
|
712
|
+
}
|
|
713
|
+
static isQuoted(value) {
|
|
714
|
+
return /^['"]/.test(value);
|
|
715
|
+
}
|
|
716
|
+
static stripInlineComment(value) {
|
|
717
|
+
const hashIndex = value.indexOf(" #");
|
|
718
|
+
if (hashIndex !== -1) {
|
|
719
|
+
return value.slice(0, hashIndex).trim();
|
|
720
|
+
}
|
|
721
|
+
return value;
|
|
722
|
+
}
|
|
723
|
+
static parseQuotedValue(lines, currentIndex, value) {
|
|
724
|
+
const quote = value[0];
|
|
725
|
+
if (!value.endsWith(quote) || value.length === 1) {
|
|
726
|
+
let multilineValue = value.slice(1);
|
|
727
|
+
let i = currentIndex + 1;
|
|
728
|
+
while (i < lines.length) {
|
|
729
|
+
const nextLine = lines[i];
|
|
730
|
+
if (nextLine.endsWith(quote)) {
|
|
731
|
+
multilineValue += "\n" + nextLine.slice(0, -1);
|
|
732
|
+
break;
|
|
733
|
+
} else {
|
|
734
|
+
multilineValue += "\n" + nextLine;
|
|
735
|
+
}
|
|
736
|
+
i++;
|
|
737
|
+
}
|
|
738
|
+
return {
|
|
739
|
+
value: multilineValue,
|
|
740
|
+
nextIndex: i
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
return {
|
|
744
|
+
value: value.slice(1, -1),
|
|
745
|
+
nextIndex: currentIndex
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
static parseUnquotedMultiline(lines, currentIndex, value) {
|
|
749
|
+
let i = currentIndex + 1;
|
|
750
|
+
while (i < lines.length && !lines[i].includes("=") && lines[i].trim() !== "") {
|
|
751
|
+
value += "\n" + lines[i];
|
|
752
|
+
i++;
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
value,
|
|
756
|
+
nextIndex: i - 1
|
|
757
|
+
};
|
|
758
|
+
}
|
|
711
759
|
/**
|
|
712
760
|
* Checks whether the specified environment variable exists.
|
|
713
761
|
*
|
package/env/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -287,6 +287,10 @@ declare class Env {
|
|
|
287
287
|
* });
|
|
288
288
|
*/
|
|
289
289
|
static getUrl(key: string, defaultValue: string, options?: UrlOptions): string;
|
|
290
|
+
private static parseUrl;
|
|
291
|
+
private static validateProtocol;
|
|
292
|
+
private static isIp;
|
|
293
|
+
private static validateHostname;
|
|
290
294
|
/**
|
|
291
295
|
* Retrieves an email environment variable and validates it.
|
|
292
296
|
*
|
|
@@ -378,6 +382,13 @@ declare class Env {
|
|
|
378
382
|
* Env.loadFromFile('.env.development');
|
|
379
383
|
*/
|
|
380
384
|
static loadFromFile(path?: string): Record<string, string>;
|
|
385
|
+
private static parseEnvContent;
|
|
386
|
+
private static isCommentOrEmpty;
|
|
387
|
+
private static extractKeyValue;
|
|
388
|
+
private static isQuoted;
|
|
389
|
+
private static stripInlineComment;
|
|
390
|
+
private static parseQuotedValue;
|
|
391
|
+
private static parseUnquotedMultiline;
|
|
381
392
|
/**
|
|
382
393
|
* Checks whether the specified environment variable exists.
|
|
383
394
|
*
|
package/env/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -83,9 +83,7 @@ var Env = class _Env {
|
|
|
83
83
|
static set(key, value) {
|
|
84
84
|
process.env[key] = value;
|
|
85
85
|
this.cache.delete(key);
|
|
86
|
-
for (const cacheKey of
|
|
87
|
-
...this.cache.keys()
|
|
88
|
-
]) {
|
|
86
|
+
for (const cacheKey of this.cache.keys()) {
|
|
89
87
|
if (cacheKey.includes(`:${key}`)) {
|
|
90
88
|
this.cache.delete(cacheKey);
|
|
91
89
|
}
|
|
@@ -439,20 +437,33 @@ var Env = class _Env {
|
|
|
439
437
|
if (!value) {
|
|
440
438
|
throw new Error(`URL environment variable '${key}' is missing or empty`);
|
|
441
439
|
}
|
|
442
|
-
|
|
440
|
+
const url = this.parseUrl(value, key);
|
|
441
|
+
this.validateProtocol(url, key, options);
|
|
442
|
+
this.validateHostname(url, key, options);
|
|
443
|
+
this.cache.set(cacheKey, value);
|
|
444
|
+
return value;
|
|
445
|
+
}
|
|
446
|
+
static parseUrl(value, key) {
|
|
443
447
|
try {
|
|
444
|
-
|
|
448
|
+
return new URL(value);
|
|
445
449
|
} catch {
|
|
446
450
|
throw new Error(`Environment variable '${key}' is not a valid URL: "${value}"`);
|
|
447
451
|
}
|
|
452
|
+
}
|
|
453
|
+
static validateProtocol(url, key, options) {
|
|
448
454
|
if (options.protocols && options.protocols.length > 0) {
|
|
449
455
|
const protocol = url.protocol.replace(":", "");
|
|
450
456
|
if (!options.protocols.includes(protocol)) {
|
|
451
457
|
throw new Error(`Environment variable '${key}' must use one of the protocols: ${options.protocols.join(", ")}. Got: ${protocol}`);
|
|
452
458
|
}
|
|
453
459
|
}
|
|
460
|
+
}
|
|
461
|
+
static isIp(hostname) {
|
|
462
|
+
return /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(hostname);
|
|
463
|
+
}
|
|
464
|
+
static validateHostname(url, key, options) {
|
|
454
465
|
const { hostname } = url;
|
|
455
|
-
const isIp =
|
|
466
|
+
const isIp = _Env.isIp(hostname);
|
|
456
467
|
const isLocalhost = hostname === "localhost";
|
|
457
468
|
if (isIp && options.allowIp === false) {
|
|
458
469
|
throw new Error(`Environment variable '${key}' cannot be an IP address: "${hostname}"`);
|
|
@@ -465,8 +476,6 @@ var Env = class _Env {
|
|
|
465
476
|
throw new Error(`Environment variable '${key}' must have a valid host with TLD: "${hostname}"`);
|
|
466
477
|
}
|
|
467
478
|
}
|
|
468
|
-
this.cache.set(cacheKey, value);
|
|
469
|
-
return value;
|
|
470
479
|
}
|
|
471
480
|
/**
|
|
472
481
|
* Retrieves an email environment variable and validates it.
|
|
@@ -649,63 +658,102 @@ var Env = class _Env {
|
|
|
649
658
|
throw new Error(`Environment file not found: "${path}"`);
|
|
650
659
|
}
|
|
651
660
|
const content = readFileSync(path, "utf8");
|
|
661
|
+
const variables = this.parseEnvContent(content);
|
|
662
|
+
for (const [k, v] of Object.entries(variables)) {
|
|
663
|
+
if (!process.env[k]) {
|
|
664
|
+
process.env[k] = v;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return variables;
|
|
668
|
+
}
|
|
669
|
+
static parseEnvContent(content) {
|
|
652
670
|
const variables = {};
|
|
653
671
|
const lines = content.split(/\r?\n/);
|
|
654
672
|
let i = 0;
|
|
655
673
|
while (i < lines.length) {
|
|
656
674
|
let line = lines[i].trim();
|
|
657
|
-
if (
|
|
675
|
+
if (this.isCommentOrEmpty(line)) {
|
|
658
676
|
i++;
|
|
659
677
|
continue;
|
|
660
678
|
}
|
|
661
|
-
const match =
|
|
679
|
+
const match = this.extractKeyValue(line);
|
|
662
680
|
if (!match) {
|
|
663
681
|
i++;
|
|
664
682
|
continue;
|
|
665
683
|
}
|
|
666
684
|
const key = match[1].trim();
|
|
667
685
|
let value = match[2].trim();
|
|
668
|
-
if (
|
|
669
|
-
|
|
670
|
-
if (hashIndex !== -1) {
|
|
671
|
-
value = value.slice(0, hashIndex).trim();
|
|
672
|
-
}
|
|
686
|
+
if (!this.isQuoted(value)) {
|
|
687
|
+
value = this.stripInlineComment(value);
|
|
673
688
|
}
|
|
674
|
-
if (
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
i++;
|
|
679
|
-
while (i < lines.length) {
|
|
680
|
-
const nextLine = lines[i];
|
|
681
|
-
if (nextLine.endsWith(quote)) {
|
|
682
|
-
multilineValue += "\n" + nextLine.slice(0, -1);
|
|
683
|
-
break;
|
|
684
|
-
} else {
|
|
685
|
-
multilineValue += "\n" + nextLine;
|
|
686
|
-
}
|
|
687
|
-
i++;
|
|
688
|
-
}
|
|
689
|
-
value = multilineValue;
|
|
690
|
-
} else {
|
|
691
|
-
value = value.slice(1, -1);
|
|
692
|
-
}
|
|
689
|
+
if (this.isQuoted(value) && value.length > 1) {
|
|
690
|
+
const result = this.parseQuotedValue(lines, i, value);
|
|
691
|
+
value = result.value;
|
|
692
|
+
i = result.nextIndex;
|
|
693
693
|
} else {
|
|
694
|
-
i
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
i++;
|
|
698
|
-
}
|
|
699
|
-
i--;
|
|
694
|
+
const result = this.parseUnquotedMultiline(lines, i, value);
|
|
695
|
+
value = result.value;
|
|
696
|
+
i = result.nextIndex;
|
|
700
697
|
}
|
|
701
698
|
if (!process.env[key]) {
|
|
702
|
-
process.env[key] = value;
|
|
703
699
|
variables[key] = value;
|
|
704
700
|
}
|
|
705
701
|
i++;
|
|
706
702
|
}
|
|
707
703
|
return variables;
|
|
708
704
|
}
|
|
705
|
+
static isCommentOrEmpty(line) {
|
|
706
|
+
return !line || line.startsWith("#");
|
|
707
|
+
}
|
|
708
|
+
static extractKeyValue(line) {
|
|
709
|
+
return line.match(/^([^=]+)=(.*)$/);
|
|
710
|
+
}
|
|
711
|
+
static isQuoted(value) {
|
|
712
|
+
return /^['"]/.test(value);
|
|
713
|
+
}
|
|
714
|
+
static stripInlineComment(value) {
|
|
715
|
+
const hashIndex = value.indexOf(" #");
|
|
716
|
+
if (hashIndex !== -1) {
|
|
717
|
+
return value.slice(0, hashIndex).trim();
|
|
718
|
+
}
|
|
719
|
+
return value;
|
|
720
|
+
}
|
|
721
|
+
static parseQuotedValue(lines, currentIndex, value) {
|
|
722
|
+
const quote = value[0];
|
|
723
|
+
if (!value.endsWith(quote) || value.length === 1) {
|
|
724
|
+
let multilineValue = value.slice(1);
|
|
725
|
+
let i = currentIndex + 1;
|
|
726
|
+
while (i < lines.length) {
|
|
727
|
+
const nextLine = lines[i];
|
|
728
|
+
if (nextLine.endsWith(quote)) {
|
|
729
|
+
multilineValue += "\n" + nextLine.slice(0, -1);
|
|
730
|
+
break;
|
|
731
|
+
} else {
|
|
732
|
+
multilineValue += "\n" + nextLine;
|
|
733
|
+
}
|
|
734
|
+
i++;
|
|
735
|
+
}
|
|
736
|
+
return {
|
|
737
|
+
value: multilineValue,
|
|
738
|
+
nextIndex: i
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
return {
|
|
742
|
+
value: value.slice(1, -1),
|
|
743
|
+
nextIndex: currentIndex
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
static parseUnquotedMultiline(lines, currentIndex, value) {
|
|
747
|
+
let i = currentIndex + 1;
|
|
748
|
+
while (i < lines.length && !lines[i].includes("=") && lines[i].trim() !== "") {
|
|
749
|
+
value += "\n" + lines[i];
|
|
750
|
+
i++;
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
value,
|
|
754
|
+
nextIndex: i - 1
|
|
755
|
+
};
|
|
756
|
+
}
|
|
709
757
|
/**
|
|
710
758
|
* Checks whether the specified environment variable exists.
|
|
711
759
|
*
|
package/exception/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/exception/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/exception/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/fs/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/fs/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/fs/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/id/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/id/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/id/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
package/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -33,8 +33,8 @@ var cache = require("./cache/index.cjs");
|
|
|
33
33
|
var contextStore = require("./context-store/index.cjs");
|
|
34
34
|
var crypto = require("./crypto/index.cjs");
|
|
35
35
|
var date = require("./date/index.cjs");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var decorator = require("./decorator/index.cjs");
|
|
37
|
+
var directory = require("./directory/index.cjs");
|
|
38
38
|
var env = require("./env/index.cjs");
|
|
39
39
|
var exception = require("./exception/index.cjs");
|
|
40
40
|
var fs = require("./fs/index.cjs");
|
|
@@ -42,7 +42,7 @@ var httpStatusCodes = require("./http-status-codes/index.cjs");
|
|
|
42
42
|
var id = require("./id/index.cjs");
|
|
43
43
|
var logger = require("./logger/index.cjs");
|
|
44
44
|
var middleware = require("./middleware/index.cjs");
|
|
45
|
-
var
|
|
45
|
+
var object = require("./object/index.cjs");
|
|
46
46
|
var performance = require("./performance/index.cjs");
|
|
47
47
|
var request = require("./request/index.cjs");
|
|
48
48
|
var response = require("./response/index.cjs");
|
|
@@ -108,16 +108,16 @@ Object.keys(date).forEach(function (k) {
|
|
|
108
108
|
get: function () { return date[k]; }
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
|
-
Object.keys(
|
|
111
|
+
Object.keys(decorator).forEach(function (k) {
|
|
112
112
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return decorator[k]; }
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
|
-
Object.keys(
|
|
117
|
+
Object.keys(directory).forEach(function (k) {
|
|
118
118
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
119
119
|
enumerable: true,
|
|
120
|
-
get: function () { return
|
|
120
|
+
get: function () { return directory[k]; }
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
Object.keys(env).forEach(function (k) {
|
|
@@ -162,10 +162,10 @@ Object.keys(middleware).forEach(function (k) {
|
|
|
162
162
|
get: function () { return middleware[k]; }
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
|
-
Object.keys(
|
|
165
|
+
Object.keys(object).forEach(function (k) {
|
|
166
166
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
167
167
|
enumerable: true,
|
|
168
|
-
get: function () { return
|
|
168
|
+
get: function () { return object[k]; }
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
171
|
Object.keys(performance).forEach(function (k) {
|