@ooneex/app-env 0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ooneex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @ooneex/app-env
@@ -0,0 +1,61 @@
1
+ type AppEnvClassType = new (env: EnvType) => IAppEnv;
2
+ declare enum Environment {
3
+ LOCAL = "local",
4
+ DEVELOPMENT = "development",
5
+ STAGING = "staging",
6
+ TESTING = "testing",
7
+ TEST = "test",
8
+ QA = "qa",
9
+ UAT = "uat",
10
+ INTEGRATION = "integration",
11
+ PREVIEW = "preview",
12
+ DEMO = "demo",
13
+ SANDBOX = "sandbox",
14
+ BETA = "beta",
15
+ CANARY = "canary",
16
+ HOTFIX = "hotfix",
17
+ PRODUCTION = "production"
18
+ }
19
+ type EnvType = `${Environment}`;
20
+ interface IAppEnv {
21
+ readonly env: EnvType;
22
+ readonly isLocal: boolean;
23
+ readonly isDevelopment: boolean;
24
+ readonly isStaging: boolean;
25
+ readonly isTesting: boolean;
26
+ readonly isTest: boolean;
27
+ readonly isQa: boolean;
28
+ readonly isUat: boolean;
29
+ readonly isIntegration: boolean;
30
+ readonly isPreview: boolean;
31
+ readonly isDemo: boolean;
32
+ readonly isSandbox: boolean;
33
+ readonly isBeta: boolean;
34
+ readonly isCanary: boolean;
35
+ readonly isHotfix: boolean;
36
+ readonly isProduction: boolean;
37
+ }
38
+ declare class AppEnv implements IAppEnv {
39
+ readonly env: EnvType;
40
+ readonly isLocal: boolean;
41
+ readonly isDevelopment: boolean;
42
+ readonly isStaging: boolean;
43
+ readonly isTesting: boolean;
44
+ readonly isTest: boolean;
45
+ readonly isQa: boolean;
46
+ readonly isUat: boolean;
47
+ readonly isIntegration: boolean;
48
+ readonly isPreview: boolean;
49
+ readonly isDemo: boolean;
50
+ readonly isSandbox: boolean;
51
+ readonly isBeta: boolean;
52
+ readonly isCanary: boolean;
53
+ readonly isHotfix: boolean;
54
+ readonly isProduction: boolean;
55
+ constructor(env: EnvType);
56
+ }
57
+ import { Exception } from "@ooneex/exception";
58
+ declare class AppEnvException extends Exception {
59
+ constructor(message: string, data?: Record<string, unknown>);
60
+ }
61
+ export { IAppEnv, Environment, EnvType, AppEnvException, AppEnvClassType, AppEnv };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import{Exception as t}from"@ooneex/exception";import{HttpStatus as s}from"@ooneex/http-status";class o extends t{constructor(i,a={}){super(i,{status:s.Code.InternalServerError,data:a});this.name="AppEnvException"}}class n{env;isLocal;isDevelopment;isStaging;isTesting;isTest;isQa;isUat;isIntegration;isPreview;isDemo;isSandbox;isBeta;isCanary;isHotfix;isProduction;constructor(i){if(this.env=i,!this.env)throw new o("APP_ENV is not set");this.isLocal=this.env==="local",this.isDevelopment=this.env==="development",this.isStaging=this.env==="staging",this.isTesting=this.env==="testing",this.isTest=this.env==="test",this.isQa=this.env==="qa",this.isUat=this.env==="uat",this.isIntegration=this.env==="integration",this.isPreview=this.env==="preview",this.isDemo=this.env==="demo",this.isSandbox=this.env==="sandbox",this.isBeta=this.env==="beta",this.isCanary=this.env==="canary",this.isHotfix=this.env==="hotfix",this.isProduction=this.env==="production"}}var l;((e)=>{e.LOCAL="local";e.DEVELOPMENT="development";e.STAGING="staging";e.TESTING="testing";e.TEST="test";e.QA="qa";e.UAT="uat";e.INTEGRATION="integration";e.PREVIEW="preview";e.DEMO="demo";e.SANDBOX="sandbox";e.BETA="beta";e.CANARY="canary";e.HOTFIX="hotfix";e.PRODUCTION="production"})(l||={});export{l as Environment,o as AppEnvException,n as AppEnv};
2
+
3
+ //# debugId=BB5FB3BC5D59A11664756E2164756E21
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/AppEnvException.ts", "src/AppEnv.ts", "src/types.ts"],
4
+ "sourcesContent": [
5
+ "import { Exception } from \"@ooneex/exception\";\nimport { HttpStatus } from \"@ooneex/http-status\";\n\nexport class AppEnvException extends Exception {\n constructor(message: string, data: Record<string, unknown> = {}) {\n super(message, {\n status: HttpStatus.Code.InternalServerError,\n data,\n });\n this.name = \"AppEnvException\";\n }\n}\n",
6
+ "import { AppEnvException } from \"./AppEnvException\";\nimport type { EnvType, IAppEnv } from \"./types\";\n\nexport class AppEnv implements IAppEnv {\n public readonly env: EnvType;\n public readonly isLocal: boolean;\n public readonly isDevelopment: boolean;\n public readonly isStaging: boolean;\n public readonly isTesting: boolean;\n public readonly isTest: boolean;\n public readonly isQa: boolean;\n public readonly isUat: boolean;\n public readonly isIntegration: boolean;\n public readonly isPreview: boolean;\n public readonly isDemo: boolean;\n public readonly isSandbox: boolean;\n public readonly isBeta: boolean;\n public readonly isCanary: boolean;\n public readonly isHotfix: boolean;\n public readonly isProduction: boolean;\n\n public constructor(env: EnvType) {\n this.env = env;\n\n if (!this.env) {\n throw new AppEnvException(\"APP_ENV is not set\");\n }\n\n this.isLocal = this.env === \"local\";\n this.isDevelopment = this.env === \"development\";\n this.isStaging = this.env === \"staging\";\n this.isTesting = this.env === \"testing\";\n this.isTest = this.env === \"test\";\n this.isQa = this.env === \"qa\";\n this.isUat = this.env === \"uat\";\n this.isIntegration = this.env === \"integration\";\n this.isPreview = this.env === \"preview\";\n this.isDemo = this.env === \"demo\";\n this.isSandbox = this.env === \"sandbox\";\n this.isBeta = this.env === \"beta\";\n this.isCanary = this.env === \"canary\";\n this.isHotfix = this.env === \"hotfix\";\n this.isProduction = this.env === \"production\";\n }\n}\n",
7
+ "export type AppEnvClassType = new (env: EnvType) => IAppEnv;\n\nexport enum Environment {\n LOCAL = \"local\",\n DEVELOPMENT = \"development\",\n STAGING = \"staging\",\n TESTING = \"testing\",\n TEST = \"test\",\n QA = \"qa\",\n UAT = \"uat\",\n INTEGRATION = \"integration\",\n PREVIEW = \"preview\",\n DEMO = \"demo\",\n SANDBOX = \"sandbox\",\n BETA = \"beta\",\n CANARY = \"canary\",\n HOTFIX = \"hotfix\",\n PRODUCTION = \"production\",\n}\n\nexport type EnvType = `${Environment}`;\n\nexport interface IAppEnv {\n readonly env: EnvType;\n readonly isLocal: boolean;\n readonly isDevelopment: boolean;\n readonly isStaging: boolean;\n readonly isTesting: boolean;\n readonly isTest: boolean;\n readonly isQa: boolean;\n readonly isUat: boolean;\n readonly isIntegration: boolean;\n readonly isPreview: boolean;\n readonly isDemo: boolean;\n readonly isSandbox: boolean;\n readonly isBeta: boolean;\n readonly isCanary: boolean;\n readonly isHotfix: boolean;\n readonly isProduction: boolean;\n}\n"
8
+ ],
9
+ "mappings": "AAAA,oBAAS,0BACT,qBAAS,4BAEF,MAAM,UAAwB,CAAU,CAC7C,WAAW,CAAC,EAAiB,EAAgC,CAAC,EAAG,CAC/D,MAAM,EAAS,CACb,OAAQ,EAAW,KAAK,oBACxB,MACF,CAAC,EACD,KAAK,KAAO,kBAEhB,CCRO,MAAM,CAA0B,CACrB,IACA,QACA,cACA,UACA,UACA,OACA,KACA,MACA,cACA,UACA,OACA,UACA,OACA,SACA,SACA,aAET,WAAW,CAAC,EAAc,CAG/B,GAFA,KAAK,IAAM,EAEP,CAAC,KAAK,IACR,MAAM,IAAI,EAAgB,oBAAoB,EAGhD,KAAK,QAAU,KAAK,MAAQ,QAC5B,KAAK,cAAgB,KAAK,MAAQ,cAClC,KAAK,UAAY,KAAK,MAAQ,UAC9B,KAAK,UAAY,KAAK,MAAQ,UAC9B,KAAK,OAAS,KAAK,MAAQ,OAC3B,KAAK,KAAO,KAAK,MAAQ,KACzB,KAAK,MAAQ,KAAK,MAAQ,MAC1B,KAAK,cAAgB,KAAK,MAAQ,cAClC,KAAK,UAAY,KAAK,MAAQ,UAC9B,KAAK,OAAS,KAAK,MAAQ,OAC3B,KAAK,UAAY,KAAK,MAAQ,UAC9B,KAAK,OAAS,KAAK,MAAQ,OAC3B,KAAK,SAAW,KAAK,MAAQ,SAC7B,KAAK,SAAW,KAAK,MAAQ,SAC7B,KAAK,aAAe,KAAK,MAAQ,aAErC,CC1CO,IAAK,GAAL,CAAK,IAAL,CACL,QAAQ,QACR,cAAc,cACd,UAAU,UACV,UAAU,UACV,OAAO,OACP,KAAK,KACL,MAAM,MACN,cAAc,cACd,UAAU,UACV,OAAO,OACP,UAAU,UACV,OAAO,OACP,SAAS,SACT,SAAS,SACT,aAAa,eAfH",
10
+ "debugId": "BB5FB3BC5D59A11664756E2164756E21",
11
+ "names": []
12
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@ooneex/app-env",
3
+ "description": "",
4
+ "version": "0.0.1",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "LICENSE",
9
+ "README.md",
10
+ "package.json"
11
+ ],
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "license": "MIT",
24
+ "scripts": {
25
+ "test": "bun test tests",
26
+ "build": "bunup",
27
+ "lint": "tsgo --noEmit && bunx biome lint",
28
+ "publish:prod": "bun publish --tolerate-republish --access public",
29
+ "publish:pack": "bun pm pack --destination ./dist",
30
+ "publish:dry": "bun publish --dry-run",
31
+ "dev": "bun run src/dev.ts"
32
+ },
33
+ "dependencies": {
34
+ "@ooneex/exception": "0.0.1",
35
+ "@ooneex/http-status": "0.0.1"
36
+ },
37
+ "devDependencies": {},
38
+ "peerDependencies": {}
39
+ }