@orion-js/env 4.3.0 → 4.4.0

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) 2022 Orionjs Team
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.
@@ -0,0 +1,2 @@
1
+ import { Config } from '../../environment/getVariables';
2
+ export declare const getConfig: (envPath: string) => Config;
@@ -0,0 +1,13 @@
1
+ export declare function generateKeys(): {
2
+ encryptKey: string;
3
+ decryptKey: string;
4
+ };
5
+ /**
6
+ * Creates a temporal keypair just to encrypt one message.
7
+ * Saves the public key in the result so that the message can be decrypted.
8
+ */
9
+ export declare function encrypt(encryptKey: string, message: string): string;
10
+ /**
11
+ * Ecrypts a message using the decrypt key
12
+ */
13
+ export declare function decrypt(decryptKey: string, encrypted: string): string;
@@ -0,0 +1,3 @@
1
+ export declare const generateKeyPair: () => any;
2
+ export declare const encrypt: (bSecretKey: Uint8Array, aPublicKey: Uint8Array, message: string) => string;
3
+ export declare const decrypt: (aSecretKey: Uint8Array, bPublicKey: Uint8Array, messageWithNonce: string) => string;
@@ -0,0 +1,5 @@
1
+ import { WithImplicitCoercion } from 'node:buffer';
2
+ export declare const decodeUTF8: (s: string | number | boolean) => Uint8Array<ArrayBuffer>;
3
+ export declare const encodeUTF8: (arr: string | any[]) => string;
4
+ export declare const encodeBase64: (arr: Uint8Array<any>) => string;
5
+ export declare const decodeBase64: (s: WithImplicitCoercion<string>) => Uint8Array<any>;
@@ -0,0 +1,4 @@
1
+ import { Config } from './getVariables';
2
+ export declare function getDts(config: Config): string;
3
+ export declare function writeDtsFile(config: Config, path: string): void;
4
+ export declare function writeDtsFileFromConfigFile(configFilePath: string, path: string): void;
@@ -0,0 +1,17 @@
1
+ export interface Config {
2
+ version: string;
3
+ publicKey: string;
4
+ cleanKeys: {
5
+ [key: string]: string;
6
+ };
7
+ encryptedKeys: {
8
+ [key: string]: string;
9
+ };
10
+ readFromSecret?: {
11
+ [key: string]: string[];
12
+ };
13
+ }
14
+ export interface Variables {
15
+ [key: string]: string;
16
+ }
17
+ export declare function getVariables(config: Config, secretKey?: string): Variables;
@@ -0,0 +1,8 @@
1
+ export * from './getDts';
2
+ export * from './load';
3
+ export interface Variables {
4
+ [key: string]: string;
5
+ }
6
+ export declare const readEnv: () => import("./getVariables").Variables;
7
+ declare const env: Variables;
8
+ export { env };
@@ -0,0 +1,6 @@
1
+ export interface LoadEnvOptions {
2
+ secretKey?: string;
3
+ envFilePath?: string;
4
+ override?: boolean;
5
+ }
6
+ export declare function loadEnv(passedOptions?: LoadEnvOptions): void;
@@ -0,0 +1,3 @@
1
+ export declare function readFile(filePath: string): string;
2
+ export declare function writeFile(path: string, content: string): void;
3
+ export declare function ensureDirectory(filePath: any): boolean;
package/dist/index.d.ts CHANGED
@@ -1,37 +1,2 @@
1
- interface Config {
2
- version: string;
3
- publicKey: string;
4
- cleanKeys: {
5
- [key: string]: string;
6
- };
7
- encryptedKeys: {
8
- [key: string]: string;
9
- };
10
- readFromSecret?: {
11
- [key: string]: string[];
12
- };
13
- }
14
- interface Variables$1 {
15
- [key: string]: string;
16
- }
17
-
18
- declare function getDts(config: Config): string;
19
- declare function writeDtsFile(config: Config, path: string): void;
20
- declare function writeDtsFileFromConfigFile(configFilePath: string, path: string): void;
21
-
22
- interface LoadEnvOptions {
23
- secretKey?: string;
24
- envFilePath?: string;
25
- override?: boolean;
26
- }
27
- declare function loadEnv(passedOptions?: LoadEnvOptions): void;
28
-
29
- interface Variables {
30
- [key: string]: string;
31
- }
32
- declare const readEnv: () => Variables$1;
33
- declare const env: Variables;
34
-
35
- declare const internalGetEnv: (orionEnvName: string, processEnvName: string) => string | null;
36
-
37
- export { type LoadEnvOptions, type Variables, env, getDts, internalGetEnv, loadEnv, readEnv, writeDtsFile, writeDtsFileFromConfigFile };
1
+ export * from './environment';
2
+ export * from './internalGetEnv';
@@ -0,0 +1 @@
1
+ export declare const internalGetEnv: (orionEnvName: string, processEnvName: string) => string | null;
File without changes
package/package.json CHANGED
@@ -1,19 +1,12 @@
1
1
  {
2
2
  "name": "@orion-js/env",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "main": "./dist/index.cjs",
5
5
  "author": "nicolaslopezj",
6
6
  "license": "MIT",
7
7
  "bin": {
8
8
  "orion-env": "./dist-cli/index.js"
9
9
  },
10
- "scripts": {
11
- "test": "bun test",
12
- "prepare": "bun run build",
13
- "clean": "rm -rf ./dist",
14
- "build": "tsup --config tsup.config.ts && tsup --config cli.tsup.config.ts",
15
- "dev": "tsup --watch"
16
- },
17
10
  "dependencies": {
18
11
  "chalk": "^4.1.2",
19
12
  "colors": "^1.4.0",
@@ -23,12 +16,12 @@
23
16
  "yaml": "^2.7.0"
24
17
  },
25
18
  "peerDependencies": {
26
- "@orion-js/logger": "4.3.0"
19
+ "@orion-js/logger": "4.4.0"
27
20
  },
28
21
  "devDependencies": {
29
22
  "@types/node": "^18.0.0",
30
23
  "tsup": "^8.0.1",
31
- "typescript": "^5.8.2"
24
+ "typescript": "^7.0.2"
32
25
  },
33
26
  "publishConfig": {
34
27
  "access": "public"
@@ -45,5 +38,11 @@
45
38
  "files": [
46
39
  "dist",
47
40
  "dist-cli"
48
- ]
49
- }
41
+ ],
42
+ "scripts": {
43
+ "test": "bun test",
44
+ "clean": "rm -rf ./dist",
45
+ "build": "tsup --config tsup.config.ts && bun run ../../scripts/emit-declarations.ts && tsup --config cli.tsup.config.ts",
46
+ "dev": "tsup --watch"
47
+ }
48
+ }
package/dist/index.d.cts DELETED
@@ -1,37 +0,0 @@
1
- interface Config {
2
- version: string;
3
- publicKey: string;
4
- cleanKeys: {
5
- [key: string]: string;
6
- };
7
- encryptedKeys: {
8
- [key: string]: string;
9
- };
10
- readFromSecret?: {
11
- [key: string]: string[];
12
- };
13
- }
14
- interface Variables$1 {
15
- [key: string]: string;
16
- }
17
-
18
- declare function getDts(config: Config): string;
19
- declare function writeDtsFile(config: Config, path: string): void;
20
- declare function writeDtsFileFromConfigFile(configFilePath: string, path: string): void;
21
-
22
- interface LoadEnvOptions {
23
- secretKey?: string;
24
- envFilePath?: string;
25
- override?: boolean;
26
- }
27
- declare function loadEnv(passedOptions?: LoadEnvOptions): void;
28
-
29
- interface Variables {
30
- [key: string]: string;
31
- }
32
- declare const readEnv: () => Variables$1;
33
- declare const env: Variables;
34
-
35
- declare const internalGetEnv: (orionEnvName: string, processEnvName: string) => string | null;
36
-
37
- export { type LoadEnvOptions, type Variables, env, getDts, internalGetEnv, loadEnv, readEnv, writeDtsFile, writeDtsFileFromConfigFile };
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
@@ -1 +0,0 @@
1
- #!/usr/bin/env node