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