@settlemint/sdk-utils
Advanced tools
Comparing version 0.4.34-pr4d6ecc1 to 0.4.34-pr5d09f78
declare function ensureFolder(path: string): void; | ||
export { ensureFolder }; | ||
declare function projectRoot(): Promise<string>; | ||
export { ensureFolder, projectRoot }; |
import { z, ZodSchema } from 'zod'; | ||
import { DotenvParseOutput } from 'dotenv'; | ||
declare function ensureFolder(path: string): void; | ||
declare function getPackageManager(targetDir: string): Promise<"yarn" | "pnpm" | "bun" | "npm">; | ||
declare function ensureServer(): void; | ||
/** | ||
@@ -16,2 +11,26 @@ * Schema for validating access tokens. | ||
/** | ||
* Schema for validating access tokens. | ||
*/ | ||
declare const DotEnvSchema: z.ZodObject<{ | ||
SETTLEMINT_ENVIRONMENT: z.ZodString; | ||
SETTLEMINT_INSTANCE: z.ZodString; | ||
SETTLEMINT_ACCESS_TOKEN: z.ZodString; | ||
SETTLEMINT_WORKSPACE: z.ZodUnion<[z.ZodString, z.ZodString]>; | ||
SETTLEMINT_APPLICATION: z.ZodUnion<[z.ZodString, z.ZodString]>; | ||
}, "strip", z.ZodTypeAny, { | ||
SETTLEMINT_ENVIRONMENT: string; | ||
SETTLEMINT_INSTANCE: string; | ||
SETTLEMINT_ACCESS_TOKEN: string; | ||
SETTLEMINT_WORKSPACE: string; | ||
SETTLEMINT_APPLICATION: string; | ||
}, { | ||
SETTLEMINT_ENVIRONMENT: string; | ||
SETTLEMINT_INSTANCE: string; | ||
SETTLEMINT_ACCESS_TOKEN: string; | ||
SETTLEMINT_WORKSPACE: string; | ||
SETTLEMINT_APPLICATION: string; | ||
}>; | ||
type DotEnv = z.infer<typeof DotEnvSchema>; | ||
/** | ||
* Schema for validating IDs. Accepts both PostgreSQL UUIDs and MongoDB ObjectIDs. | ||
@@ -44,2 +63,25 @@ */ | ||
export { type AccessToken, AccessTokenSchema, type Id, IdSchema, type Url, UrlSchema, ensureFolder, ensureServer, getPackageManager, validate }; | ||
/** | ||
* Loads environment variables from .env files. | ||
* To enable encryption with dotenvx (https://www.dotenvx.com/docs) run `bunx dotenvx encrypt` | ||
* | ||
* @returns A promise that resolves to the validated environment variables. | ||
* @throws Will throw an error if validation fails. | ||
* | ||
* @example | ||
* const env = await loadEnv(); | ||
* console.log(env.SETTLEMINT_INSTANCE); | ||
*/ | ||
declare function loadEnv<T extends boolean = true>(validateEnv?: T): Promise<T extends true ? DotEnv : DotenvParseOutput>; | ||
declare function writeEnv(env: Partial<DotEnv>, environment: string, secrets: boolean): Promise<void>; | ||
declare function ensureFolder(path: string): void; | ||
declare function projectRoot(): Promise<string>; | ||
declare function getPackageManager(targetDir: string): Promise<"yarn" | "pnpm" | "bun" | "npm">; | ||
declare function ensureServer(): void; | ||
export { type AccessToken, AccessTokenSchema, type DotEnv, DotEnvSchema, type Id, IdSchema, type Url, UrlSchema, ensureFolder, ensureServer, getPackageManager, loadEnv, projectRoot, validate, writeEnv }; |
@@ -10,2 +10,26 @@ import { z, ZodSchema } from 'zod'; | ||
/** | ||
* Schema for validating access tokens. | ||
*/ | ||
declare const DotEnvSchema: z.ZodObject<{ | ||
SETTLEMINT_ENVIRONMENT: z.ZodString; | ||
SETTLEMINT_INSTANCE: z.ZodString; | ||
SETTLEMINT_ACCESS_TOKEN: z.ZodString; | ||
SETTLEMINT_WORKSPACE: z.ZodUnion<[z.ZodString, z.ZodString]>; | ||
SETTLEMINT_APPLICATION: z.ZodUnion<[z.ZodString, z.ZodString]>; | ||
}, "strip", z.ZodTypeAny, { | ||
SETTLEMINT_ENVIRONMENT: string; | ||
SETTLEMINT_INSTANCE: string; | ||
SETTLEMINT_ACCESS_TOKEN: string; | ||
SETTLEMINT_WORKSPACE: string; | ||
SETTLEMINT_APPLICATION: string; | ||
}, { | ||
SETTLEMINT_ENVIRONMENT: string; | ||
SETTLEMINT_INSTANCE: string; | ||
SETTLEMINT_ACCESS_TOKEN: string; | ||
SETTLEMINT_WORKSPACE: string; | ||
SETTLEMINT_APPLICATION: string; | ||
}>; | ||
type DotEnv = z.infer<typeof DotEnvSchema>; | ||
/** | ||
* Schema for validating IDs. Accepts both PostgreSQL UUIDs and MongoDB ObjectIDs. | ||
@@ -38,2 +62,2 @@ */ | ||
export { type AccessToken, AccessTokenSchema, type Id, IdSchema, type Url, UrlSchema, validate }; | ||
export { type AccessToken, AccessTokenSchema, type DotEnv, DotEnvSchema, type Id, IdSchema, type Url, UrlSchema, validate }; |
{ | ||
"name": "@settlemint/sdk-utils", | ||
"description": "SettleMint SDK, integrate SettleMint into your application with ease.", | ||
"version": "0.4.34-pr4d6ecc1", | ||
"version": "0.4.34-pr5d09f78", | ||
"type": "module", | ||
@@ -61,3 +61,9 @@ "private": false, | ||
"dependencies": { | ||
"@antfu/ni": "^0.23.0" | ||
"@antfu/ni": "^0.23", | ||
"@dotenvx/dotenvx": "^1", | ||
"deepmerge-ts": "^7", | ||
"environment": "^1", | ||
"find-up": "^7", | ||
"yocto-spinner": "^0.1", | ||
"yoctocolors": "^2" | ||
}, | ||
@@ -64,0 +70,0 @@ "peerDependencies": {}, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123804
45
1251
7
13
+ Added@dotenvx/dotenvx@^1
+ Addeddeepmerge-ts@^7
+ Addedenvironment@^1
+ Addedfind-up@^7
+ Addedyocto-spinner@^0.1
+ Addedyoctocolors@^2
+ Added@dotenvx/dotenvx@1.31.0(transitive)
+ Added@ecies/ciphers@0.2.2(transitive)
+ Added@noble/ciphers@1.1.3(transitive)
+ Added@noble/curves@1.7.0(transitive)
+ Added@noble/hashes@1.6.01.6.1(transitive)
+ Addedcommander@11.1.0(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addeddeepmerge-ts@7.1.3(transitive)
+ Addeddotenv@16.4.7(transitive)
+ Addedeciesjs@0.4.12(transitive)
+ Addedenvironment@1.1.0(transitive)
+ Addedexeca@5.1.1(transitive)
+ Addedfdir@6.4.2(transitive)
+ Addedfind-up@7.0.0(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedhuman-signals@2.1.0(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedisexe@2.0.03.1.1(transitive)
+ Addedlocate-path@7.2.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addednpm-run-path@4.0.1(transitive)
+ Addedobject-treeify@1.1.33(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedp-limit@4.0.0(transitive)
+ Addedp-locate@6.0.0(transitive)
+ Addedpath-exists@5.0.0(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpicomatch@4.0.2(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstrip-final-newline@2.0.0(transitive)
+ Addedunicorn-magic@0.1.0(transitive)
+ Addedwhich@2.0.24.0.0(transitive)
+ Addedyocto-queue@1.1.1(transitive)
+ Addedyocto-spinner@0.1.2(transitive)
+ Addedyoctocolors@2.1.1(transitive)
Updated@antfu/ni@^0.23