@arikajs/foundation 0.0.3 → 0.0.5
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/README.md +25 -23
- package/dist/ObjectPool.d.ts +9 -0
- package/dist/ObjectPool.d.ts.map +1 -0
- package/dist/ObjectPool.js +25 -0
- package/dist/ObjectPool.js.map +1 -0
- package/dist/application/Application.d.ts +47 -15
- package/dist/application/Application.d.ts.map +1 -1
- package/dist/application/Application.js +121 -50
- package/dist/application/Application.js.map +1 -1
- package/dist/container/Container.d.ts +22 -0
- package/dist/container/Container.d.ts.map +1 -1
- package/dist/container/Container.js +60 -7
- package/dist/container/Container.js.map +1 -1
- package/dist/contracts/Application.d.ts +5 -0
- package/dist/contracts/Application.d.ts.map +1 -1
- package/dist/examples/basic.d.ts +3 -0
- package/dist/examples/basic.d.ts.map +1 -0
- package/dist/examples/basic.js +110 -0
- package/dist/examples/basic.js.map +1 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/src/ObjectPool.d.ts +9 -0
- package/dist/src/ObjectPool.d.ts.map +1 -0
- package/dist/src/ObjectPool.js +25 -0
- package/dist/src/ObjectPool.js.map +1 -0
- package/dist/src/application/Application.d.ts +105 -0
- package/dist/src/application/Application.d.ts.map +1 -0
- package/dist/src/application/Application.js +267 -0
- package/dist/src/application/Application.js.map +1 -0
- package/dist/src/container/Container.d.ts +61 -0
- package/dist/src/container/Container.d.ts.map +1 -0
- package/dist/src/container/Container.js +126 -0
- package/dist/src/container/Container.js.map +1 -0
- package/dist/src/contracts/Application.d.ts +20 -0
- package/dist/src/contracts/Application.d.ts.map +1 -0
- package/dist/src/contracts/Application.js +3 -0
- package/dist/src/contracts/Application.js.map +1 -0
- package/dist/src/contracts/Kernel.d.ts +24 -0
- package/dist/src/contracts/Kernel.d.ts.map +1 -0
- package/dist/src/contracts/Kernel.js +3 -0
- package/dist/src/contracts/Kernel.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +28 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/providers/ServiceProvider.d.ts +25 -0
- package/dist/src/providers/ServiceProvider.d.ts.map +1 -0
- package/dist/src/providers/ServiceProvider.js +26 -0
- package/dist/src/providers/ServiceProvider.js.map +1 -0
- package/dist/tests/application.test.d.ts +2 -0
- package/dist/tests/application.test.d.ts.map +1 -0
- package/dist/tests/application.test.js +213 -0
- package/dist/tests/application.test.js.map +1 -0
- package/dist/tests/config.test.d.ts +2 -0
- package/dist/tests/config.test.d.ts.map +1 -0
- package/dist/tests/config.test.js +120 -0
- package/dist/tests/config.test.js.map +1 -0
- package/dist/tests/config_helper.test.d.ts +2 -0
- package/dist/tests/config_helper.test.d.ts.map +1 -0
- package/dist/tests/config_helper.test.js +46 -0
- package/dist/tests/config_helper.test.js.map +1 -0
- package/dist/tests/container.test.d.ts +2 -0
- package/dist/tests/container.test.d.ts.map +1 -0
- package/dist/tests/container.test.js +94 -0
- package/dist/tests/container.test.js.map +1 -0
- package/dist/tests/env.test.d.ts +2 -0
- package/dist/tests/env.test.d.ts.map +1 -0
- package/dist/tests/env.test.js +101 -0
- package/dist/tests/env.test.js.map +1 -0
- package/dist/tests/provider.test.d.ts +2 -0
- package/dist/tests/provider.test.d.ts.map +1 -0
- package/dist/tests/provider.test.js +87 -0
- package/dist/tests/provider.test.js.map +1 -0
- package/dist/tests/timezone.test.d.ts +2 -0
- package/dist/tests/timezone.test.d.ts.map +1 -0
- package/dist/tests/timezone.test.js +47 -0
- package/dist/tests/timezone.test.js.map +1 -0
- package/package.json +13 -11
- package/dist/config/Repository.d.ts +0 -41
- package/dist/config/Repository.d.ts.map +0 -1
- package/dist/config/Repository.js +0 -140
- package/dist/config/Repository.js.map +0 -1
- package/dist/support/EnvLoader.d.ts +0 -15
- package/dist/support/EnvLoader.d.ts.map +0 -1
- package/dist/support/EnvLoader.js +0 -58
- package/dist/support/EnvLoader.js.map +0 -1
- package/dist/support/config.d.ts +0 -18
- package/dist/support/config.d.ts.map +0 -1
- package/dist/support/config.js +0 -29
- package/dist/support/config.js.map +0 -1
- package/dist/support/env.d.ts +0 -9
- package/dist/support/env.d.ts.map +0 -1
- package/dist/support/env.js +0 -32
- package/dist/support/env.js.map +0 -1
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration repository for ArikaJS.
|
|
3
|
-
*
|
|
4
|
-
* Loads configuration files from the /config directory and provides
|
|
5
|
-
* read-only access to configuration values.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Repository {
|
|
8
|
-
private config;
|
|
9
|
-
private booted;
|
|
10
|
-
/**
|
|
11
|
-
* Load configuration files from the config directory.
|
|
12
|
-
*/
|
|
13
|
-
loadConfigDirectory(configPath: string): void;
|
|
14
|
-
/**
|
|
15
|
-
* Get a configuration value using dot notation.
|
|
16
|
-
* Example: get('app.name') returns config.app.name
|
|
17
|
-
*/
|
|
18
|
-
get<T = any>(key: string, defaultValue?: T): T | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Check if a configuration key exists.
|
|
21
|
-
*/
|
|
22
|
-
has(key: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Set a configuration value using dot notation.
|
|
25
|
-
* Example: set('app.key', 'value')
|
|
26
|
-
*/
|
|
27
|
-
set(key: string, value: any): void;
|
|
28
|
-
/**
|
|
29
|
-
* Get all configuration.
|
|
30
|
-
*/
|
|
31
|
-
all(): Record<string, any>;
|
|
32
|
-
/**
|
|
33
|
-
* Mark the repository as booted (read-only).
|
|
34
|
-
*/
|
|
35
|
-
markAsBooted(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Check if the repository has been booted.
|
|
38
|
-
*/
|
|
39
|
-
isBooted(): boolean;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=Repository.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.d.ts","sourceRoot":"","sources":["../../src/config/Repository.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,MAAM,CAAS;IAEvB;;OAEG;IACH,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAkC7C;;;OAGG;IACH,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAc1D;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAmBlC;;OAEG;IACH,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI1B;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,QAAQ,IAAI,OAAO;CAGpB"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Repository = void 0;
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
/**
|
|
40
|
-
* Configuration repository for ArikaJS.
|
|
41
|
-
*
|
|
42
|
-
* Loads configuration files from the /config directory and provides
|
|
43
|
-
* read-only access to configuration values.
|
|
44
|
-
*/
|
|
45
|
-
class Repository {
|
|
46
|
-
constructor() {
|
|
47
|
-
this.config = {};
|
|
48
|
-
this.booted = false;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Load configuration files from the config directory.
|
|
52
|
-
*/
|
|
53
|
-
loadConfigDirectory(configPath) {
|
|
54
|
-
if (this.booted) {
|
|
55
|
-
throw new Error('Configuration cannot be modified after boot.');
|
|
56
|
-
}
|
|
57
|
-
if (!fs.existsSync(configPath)) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const files = fs.readdirSync(configPath);
|
|
61
|
-
const configFiles = files.filter((file) => file.endsWith('.js') || file.endsWith('.ts'));
|
|
62
|
-
for (const file of configFiles) {
|
|
63
|
-
const filePath = path.join(configPath, file);
|
|
64
|
-
const configName = path.basename(file, path.extname(file));
|
|
65
|
-
try {
|
|
66
|
-
// Load config file - expects compiled JS in production
|
|
67
|
-
// For TS files, they should be pre-compiled to JS
|
|
68
|
-
const configModule = require(filePath);
|
|
69
|
-
const configValue = configModule.default || configModule;
|
|
70
|
-
if (typeof configValue === 'object' && configValue !== null) {
|
|
71
|
-
this.config[configName] = configValue;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
// Silently skip files that can't be loaded
|
|
76
|
-
// In production, you might want to log this
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Get a configuration value using dot notation.
|
|
82
|
-
* Example: get('app.name') returns config.app.name
|
|
83
|
-
*/
|
|
84
|
-
get(key, defaultValue) {
|
|
85
|
-
const keys = key.split('.');
|
|
86
|
-
let value = this.config;
|
|
87
|
-
for (const k of keys) {
|
|
88
|
-
if (value === undefined || value === null) {
|
|
89
|
-
return defaultValue;
|
|
90
|
-
}
|
|
91
|
-
value = value[k];
|
|
92
|
-
}
|
|
93
|
-
return value !== undefined ? value : defaultValue;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Check if a configuration key exists.
|
|
97
|
-
*/
|
|
98
|
-
has(key) {
|
|
99
|
-
return this.get(key) !== undefined;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Set a configuration value using dot notation.
|
|
103
|
-
* Example: set('app.key', 'value')
|
|
104
|
-
*/
|
|
105
|
-
set(key, value) {
|
|
106
|
-
if (this.booted) {
|
|
107
|
-
throw new Error('Configuration cannot be modified after boot.');
|
|
108
|
-
}
|
|
109
|
-
const keys = key.split('.');
|
|
110
|
-
let current = this.config;
|
|
111
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
112
|
-
const k = keys[i];
|
|
113
|
-
if (!(k in current) || typeof current[k] !== 'object' || current[k] === null) {
|
|
114
|
-
current[k] = {};
|
|
115
|
-
}
|
|
116
|
-
current = current[k];
|
|
117
|
-
}
|
|
118
|
-
current[keys[keys.length - 1]] = value;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Get all configuration.
|
|
122
|
-
*/
|
|
123
|
-
all() {
|
|
124
|
-
return { ...this.config };
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Mark the repository as booted (read-only).
|
|
128
|
-
*/
|
|
129
|
-
markAsBooted() {
|
|
130
|
-
this.booted = true;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Check if the repository has been booted.
|
|
134
|
-
*/
|
|
135
|
-
isBooted() {
|
|
136
|
-
return this.booted;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.Repository = Repository;
|
|
140
|
-
//# sourceMappingURL=Repository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.js","sourceRoot":"","sources":["../../src/config/Repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAK7B;;;;;GAKG;AACH,MAAa,UAAU;IAAvB;QACU,WAAM,GAAwB,EAAE,CAAC;QACjC,WAAM,GAAG,KAAK,CAAC;IA2GzB,CAAC;IAzGC;;OAEG;IACH,mBAAmB,CAAC,UAAkB;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAC9B,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAA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variable loader for ArikaJS.
|
|
3
|
-
*
|
|
4
|
-
* Uses dotenv to load key=value pairs from a .env file
|
|
5
|
-
* and injects them into process.env.
|
|
6
|
-
*/
|
|
7
|
-
export declare class EnvLoader {
|
|
8
|
-
/**
|
|
9
|
-
* Load the .env file from the given directory.
|
|
10
|
-
*
|
|
11
|
-
* @param directory The directory where the .env file is located
|
|
12
|
-
*/
|
|
13
|
-
static load(directory: string): void;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=EnvLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnvLoader.d.ts","sourceRoot":"","sources":["../../src/support/EnvLoader.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,SAAS;IAClB;;;;OAIG;WACW,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAM9C"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.EnvLoader = void 0;
|
|
37
|
-
const dotenv = __importStar(require("dotenv"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
/**
|
|
40
|
-
* Environment variable loader for ArikaJS.
|
|
41
|
-
*
|
|
42
|
-
* Uses dotenv to load key=value pairs from a .env file
|
|
43
|
-
* and injects them into process.env.
|
|
44
|
-
*/
|
|
45
|
-
class EnvLoader {
|
|
46
|
-
/**
|
|
47
|
-
* Load the .env file from the given directory.
|
|
48
|
-
*
|
|
49
|
-
* @param directory The directory where the .env file is located
|
|
50
|
-
*/
|
|
51
|
-
static load(directory) {
|
|
52
|
-
const envPath = path.join(directory, '.env');
|
|
53
|
-
// Use dotenv to load environment variables
|
|
54
|
-
dotenv.config({ path: envPath });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.EnvLoader = EnvLoader;
|
|
58
|
-
//# sourceMappingURL=EnvLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnvLoader.js","sourceRoot":"","sources":["../../src/support/EnvLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,2CAA6B;AAE7B;;;;;GAKG;AACH,MAAa,SAAS;IAClB;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAC,SAAiB;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE7C,2CAA2C;QAC3C,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACrC,CAAC;CACJ;AAZD,8BAYC"}
|
package/dist/support/config.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Repository } from '../config/Repository';
|
|
2
|
-
/**
|
|
3
|
-
* Set the active configuration repository.
|
|
4
|
-
*
|
|
5
|
-
* This is used by the config() helper to find the current configuration.
|
|
6
|
-
*
|
|
7
|
-
* @param repo The repository instance
|
|
8
|
-
*/
|
|
9
|
-
export declare function setConfigRepository(repo: Repository): void;
|
|
10
|
-
/**
|
|
11
|
-
* Get a configuration value.
|
|
12
|
-
*
|
|
13
|
-
* @param key The configuration key (dot notation)
|
|
14
|
-
* @param defaultValue The default value if the key is not found
|
|
15
|
-
* @returns The configuration value or the default value
|
|
16
|
-
*/
|
|
17
|
-
export declare function config<T = any>(key: string, defaultValue?: T): T | undefined;
|
|
18
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/support/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAM5E"}
|
package/dist/support/config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setConfigRepository = setConfigRepository;
|
|
4
|
-
exports.config = config;
|
|
5
|
-
let activeRepo = null;
|
|
6
|
-
/**
|
|
7
|
-
* Set the active configuration repository.
|
|
8
|
-
*
|
|
9
|
-
* This is used by the config() helper to find the current configuration.
|
|
10
|
-
*
|
|
11
|
-
* @param repo The repository instance
|
|
12
|
-
*/
|
|
13
|
-
function setConfigRepository(repo) {
|
|
14
|
-
activeRepo = repo;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get a configuration value.
|
|
18
|
-
*
|
|
19
|
-
* @param key The configuration key (dot notation)
|
|
20
|
-
* @param defaultValue The default value if the key is not found
|
|
21
|
-
* @returns The configuration value or the default value
|
|
22
|
-
*/
|
|
23
|
-
function config(key, defaultValue) {
|
|
24
|
-
if (!activeRepo) {
|
|
25
|
-
return defaultValue;
|
|
26
|
-
}
|
|
27
|
-
return activeRepo.get(key, defaultValue);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/support/config.ts"],"names":[],"mappings":";;AAWA,kDAEC;AASD,wBAMC;AA1BD,IAAI,UAAU,GAAsB,IAAI,CAAC;AAEzC;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,IAAgB;IAChD,UAAU,GAAG,IAAI,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,MAAM,CAAU,GAAW,EAAE,YAAgB;IACzD,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,YAAY,CAAC;IACxB,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/support/env.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the value of an environment variable.
|
|
3
|
-
*
|
|
4
|
-
* @param key The environment variable key
|
|
5
|
-
* @param defaultValue The default value if the key is not set
|
|
6
|
-
* @returns The environment variable value or the default value
|
|
7
|
-
*/
|
|
8
|
-
export declare function env<T = string>(key: string, defaultValue?: T): T;
|
|
9
|
-
//# sourceMappingURL=env.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/support/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CA0BhE"}
|
package/dist/support/env.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.env = env;
|
|
4
|
-
/**
|
|
5
|
-
* Get the value of an environment variable.
|
|
6
|
-
*
|
|
7
|
-
* @param key The environment variable key
|
|
8
|
-
* @param defaultValue The default value if the key is not set
|
|
9
|
-
* @returns The environment variable value or the default value
|
|
10
|
-
*/
|
|
11
|
-
function env(key, defaultValue) {
|
|
12
|
-
const value = process.env[key];
|
|
13
|
-
if (value === undefined) {
|
|
14
|
-
return defaultValue;
|
|
15
|
-
}
|
|
16
|
-
// Handle common boolean strings
|
|
17
|
-
if (value.toLowerCase() === 'true') {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
if (value.toLowerCase() === 'false') {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
// Handle common null/empty strings
|
|
24
|
-
if (value.toLowerCase() === 'null') {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
if (value.toLowerCase() === '(empty)') {
|
|
28
|
-
return '';
|
|
29
|
-
}
|
|
30
|
-
return value;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=env.js.map
|
package/dist/support/env.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/support/env.ts"],"names":[],"mappings":";;AAOA,kBA0BC;AAjCD;;;;;;GAMG;AACH,SAAgB,GAAG,CAAa,GAAW,EAAE,YAAgB;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,YAAiB,CAAC;IAC3B,CAAC;IAED,gCAAgC;IAChC,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QACnC,OAAO,IAAW,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,OAAO,EAAE,CAAC;QACpC,OAAO,KAAY,CAAC;IACtB,CAAC;IAED,mCAAmC;IACnC,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QACnC,OAAO,IAAW,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,EAAS,CAAC;IACnB,CAAC;IAED,OAAO,KAAY,CAAC;AACtB,CAAC"}
|