@theholocron/doppler-client 0.5.0 → 0.6.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/dist/index.d.mts +82 -0
- package/dist/index.mjs +82 -0
- package/package.json +2 -2
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import "@theholocron/http-client";
|
|
2
|
+
//#region src/utils.d.ts
|
|
3
|
+
interface DopplerClientOptions {
|
|
4
|
+
/** Doppler service token or personal token. */
|
|
5
|
+
token: string;
|
|
6
|
+
/** Override base URL for testing. Defaults to https://api.doppler.com/v3. */
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
/** Override fetch for testing. Defaults to globalThis.fetch. */
|
|
9
|
+
fetch?: typeof fetch;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/environments/environments.d.ts
|
|
13
|
+
interface DopplerEnvironment {
|
|
14
|
+
id?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
slug?: string;
|
|
17
|
+
}
|
|
18
|
+
interface DopplerEnvironmentsResponse {
|
|
19
|
+
environments?: DopplerEnvironment[];
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/me/me.d.ts
|
|
23
|
+
interface DopplerMe {
|
|
24
|
+
/** Token type: "cli" | "personal" | "service" | "service_account". */
|
|
25
|
+
type?: string;
|
|
26
|
+
/** Workplace-level identifier. */
|
|
27
|
+
slug?: string;
|
|
28
|
+
/** Present on account-level tokens. */
|
|
29
|
+
workplace?: {
|
|
30
|
+
name?: string;
|
|
31
|
+
slug?: string;
|
|
32
|
+
};
|
|
33
|
+
/** Present on user tokens. */
|
|
34
|
+
name?: string;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/projects/projects.d.ts
|
|
38
|
+
interface DopplerProject {
|
|
39
|
+
id?: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
slug?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
44
|
+
interface DopplerProjectResponse {
|
|
45
|
+
project?: DopplerProject;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/secrets/secrets.d.ts
|
|
49
|
+
interface DopplerSecretValue {
|
|
50
|
+
raw?: string;
|
|
51
|
+
computed?: string;
|
|
52
|
+
}
|
|
53
|
+
interface DopplerSecret {
|
|
54
|
+
name?: string;
|
|
55
|
+
value?: DopplerSecretValue | null;
|
|
56
|
+
}
|
|
57
|
+
interface DopplerSecretsMap {
|
|
58
|
+
secrets?: Record<string, DopplerSecretValue | null>;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/index.d.ts
|
|
62
|
+
declare function createDopplerClient(opts: DopplerClientOptions): {
|
|
63
|
+
environments: {
|
|
64
|
+
list: (project: string) => Promise<DopplerEnvironmentsResponse>;
|
|
65
|
+
create: (project: string, name: string, slug: string) => Promise<DopplerEnvironmentsResponse>;
|
|
66
|
+
};
|
|
67
|
+
me: {
|
|
68
|
+
get: () => Promise<DopplerMe>;
|
|
69
|
+
};
|
|
70
|
+
projects: {
|
|
71
|
+
create: (name: string, description?: string) => Promise<DopplerProjectResponse>;
|
|
72
|
+
};
|
|
73
|
+
secrets: {
|
|
74
|
+
get: (project: string, config: string, name: string) => Promise<DopplerSecret>;
|
|
75
|
+
list: (project: string, config: string) => Promise<DopplerSecretsMap>;
|
|
76
|
+
update: (project: string, config: string, values: Record<string, string>) => Promise<DopplerSecretsMap>;
|
|
77
|
+
download: (project: string, config: string) => Promise<Record<string, string>>;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
type DopplerClient = ReturnType<typeof createDopplerClient>;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { DopplerClient, type DopplerClientOptions, type DopplerEnvironment, type DopplerEnvironmentsResponse, type DopplerMe, type DopplerProject, type DopplerProjectResponse, type DopplerSecret, type DopplerSecretValue, type DopplerSecretsMap, createDopplerClient };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRestClient } from "@theholocron/http-client";
|
|
2
|
+
//#region src/utils.ts
|
|
3
|
+
function createDopplerRestClient(opts) {
|
|
4
|
+
return createRestClient({
|
|
5
|
+
baseUrl: opts.baseUrl ?? "https://api.doppler.com/v3",
|
|
6
|
+
token: opts.token,
|
|
7
|
+
vendor: "Doppler",
|
|
8
|
+
fetch: opts.fetch
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/environments/environments.ts
|
|
13
|
+
function environments(rest) {
|
|
14
|
+
return {
|
|
15
|
+
list: (project) => rest.request("/environments", { query: { project } }),
|
|
16
|
+
create: (project, name, slug) => rest.request("/environments", {
|
|
17
|
+
method: "POST",
|
|
18
|
+
body: {
|
|
19
|
+
project,
|
|
20
|
+
name,
|
|
21
|
+
slug
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/me/me.ts
|
|
28
|
+
function me(rest) {
|
|
29
|
+
return { get: () => rest.request("/me") };
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/projects/projects.ts
|
|
33
|
+
function projects(rest) {
|
|
34
|
+
return { create: (name, description) => rest.request("/projects", {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: {
|
|
37
|
+
name,
|
|
38
|
+
...description !== void 0 ? { description } : {}
|
|
39
|
+
}
|
|
40
|
+
}) };
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/secrets/secrets.ts
|
|
44
|
+
function secrets(rest) {
|
|
45
|
+
return {
|
|
46
|
+
get: (project, config, name) => rest.request("/configs/config/secret", { query: {
|
|
47
|
+
project,
|
|
48
|
+
config,
|
|
49
|
+
name
|
|
50
|
+
} }),
|
|
51
|
+
list: (project, config) => rest.request("/configs/config/secrets", { query: {
|
|
52
|
+
project,
|
|
53
|
+
config
|
|
54
|
+
} }),
|
|
55
|
+
update: (project, config, values) => rest.request("/configs/config/secrets", {
|
|
56
|
+
method: "POST",
|
|
57
|
+
body: {
|
|
58
|
+
project,
|
|
59
|
+
config,
|
|
60
|
+
secrets: values
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
download: (project, config) => rest.request("/configs/config/secrets/download", { query: {
|
|
64
|
+
project,
|
|
65
|
+
config,
|
|
66
|
+
format: "json"
|
|
67
|
+
} })
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/index.ts
|
|
72
|
+
function createDopplerClient(opts) {
|
|
73
|
+
const rest = createDopplerRestClient(opts);
|
|
74
|
+
return {
|
|
75
|
+
environments: environments(rest),
|
|
76
|
+
me: me(rest),
|
|
77
|
+
projects: projects(rest),
|
|
78
|
+
secrets: secrets(rest)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { createDopplerClient };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/doppler-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "A TypeScript client for the Doppler API",
|
|
5
5
|
"homepage": "https://github.com/theholocron/clients/tree/main/packages/doppler-client#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/clients/issues",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@theholocron/http-client": "^0.
|
|
24
|
+
"@theholocron/http-client": "^0.6.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^26.1.1",
|