@secretenvs/sdk 1.7.0 → 2.0.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/README.md +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@ no arguments.
|
|
|
55
55
|
- `getResolved(target)` returns `{ project, environment, variables[] }` where each
|
|
56
56
|
variable has `{ key, value, source: 'environment' | 'shared' }`.
|
|
57
57
|
- `listProjects()` returns the projects and environments visible to the token.
|
|
58
|
+
- `me()` returns `{ id, email, name }` of the account the token belongs to.
|
|
58
59
|
- `clearCache()` empties the in-memory cache.
|
|
59
60
|
|
|
60
61
|
## Errors
|
package/dist/index.cjs
CHANGED
|
@@ -158,6 +158,10 @@ var SecretEnvs = class {
|
|
|
158
158
|
this.#fetch = fetchImpl;
|
|
159
159
|
this.#env = env;
|
|
160
160
|
}
|
|
161
|
+
/** The account the token belongs to (name and email only). */
|
|
162
|
+
async me() {
|
|
163
|
+
return this.#get("/api/v1/sdk/me", (body) => import_contracts.SdkMeDto.parse(body));
|
|
164
|
+
}
|
|
161
165
|
/** Projects visible to the token, with their environments. */
|
|
162
166
|
async listProjects() {
|
|
163
167
|
return this.#get(
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedVariablesResponse } from '@secretenvs/contracts';
|
|
2
|
-
export { ResolvedVariableDto, ResolvedVariablesResponse, SdkProjectDto } from '@secretenvs/contracts';
|
|
2
|
+
export { ResolvedVariableDto, ResolvedVariablesResponse, SdkMeDto, SdkProjectDto } from '@secretenvs/contracts';
|
|
3
3
|
|
|
4
4
|
declare class SecretEnvsError extends Error {
|
|
5
5
|
constructor(message: string, options?: {
|
|
@@ -61,6 +61,12 @@ declare function normalizeBaseUrl(raw: string): string;
|
|
|
61
61
|
declare class SecretEnvs {
|
|
62
62
|
#private;
|
|
63
63
|
constructor(options?: SecretEnvsOptions);
|
|
64
|
+
/** The account the token belongs to (name and email only). */
|
|
65
|
+
me(): Promise<{
|
|
66
|
+
id: string;
|
|
67
|
+
email: string;
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
64
70
|
/** Projects visible to the token, with their environments. */
|
|
65
71
|
listProjects(): Promise<{
|
|
66
72
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedVariablesResponse } from '@secretenvs/contracts';
|
|
2
|
-
export { ResolvedVariableDto, ResolvedVariablesResponse, SdkProjectDto } from '@secretenvs/contracts';
|
|
2
|
+
export { ResolvedVariableDto, ResolvedVariablesResponse, SdkMeDto, SdkProjectDto } from '@secretenvs/contracts';
|
|
3
3
|
|
|
4
4
|
declare class SecretEnvsError extends Error {
|
|
5
5
|
constructor(message: string, options?: {
|
|
@@ -61,6 +61,12 @@ declare function normalizeBaseUrl(raw: string): string;
|
|
|
61
61
|
declare class SecretEnvs {
|
|
62
62
|
#private;
|
|
63
63
|
constructor(options?: SecretEnvsOptions);
|
|
64
|
+
/** The account the token belongs to (name and email only). */
|
|
65
|
+
me(): Promise<{
|
|
66
|
+
id: string;
|
|
67
|
+
email: string;
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
64
70
|
/** Projects visible to the token, with their environments. */
|
|
65
71
|
listProjects(): Promise<{
|
|
66
72
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ var SecretEnvsNotFoundError = class extends SecretEnvsApiError {
|
|
|
38
38
|
import {
|
|
39
39
|
ApiErrorBody,
|
|
40
40
|
ResolvedVariablesResponse,
|
|
41
|
+
SdkMeDto,
|
|
41
42
|
SdkProjectDto
|
|
42
43
|
} from "@secretenvs/contracts";
|
|
43
44
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -130,6 +131,10 @@ var SecretEnvs = class {
|
|
|
130
131
|
this.#fetch = fetchImpl;
|
|
131
132
|
this.#env = env;
|
|
132
133
|
}
|
|
134
|
+
/** The account the token belongs to (name and email only). */
|
|
135
|
+
async me() {
|
|
136
|
+
return this.#get("/api/v1/sdk/me", (body) => SdkMeDto.parse(body));
|
|
137
|
+
}
|
|
133
138
|
/** Projects visible to the token, with their environments. */
|
|
134
139
|
async listProjects() {
|
|
135
140
|
return this.#get(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secretenvs/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Node client for loading SecretEnvs variables into process.env.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ankityadavpurson/secretenvs#readme",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"test": "vitest run --passWithNoTests"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@secretenvs/contracts": "
|
|
50
|
+
"@secretenvs/contracts": "2.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"tsup": "^8.5.0",
|