@phala/cloud 0.2.3 → 0.2.5
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/actions/apps/get_app_attestation.d.ts +963 -0
- package/dist/actions/apps/get_app_device_allowlist.d.ts +108 -0
- package/dist/actions/blockchains/abi/dstack_app.d.ts +101 -0
- package/dist/actions/blockchains/add_device.d.ts +62 -0
- package/dist/actions/blockchains/check_device_allowed.d.ts +44 -0
- package/dist/actions/blockchains/get_allowed_devices.d.ts +65 -0
- package/dist/actions/blockchains/remove_device.d.ts +62 -0
- package/dist/actions/blockchains/set_allow_any_device.d.ts +62 -0
- package/dist/actions/cvms/get_cvm_attestation.d.ts +220 -0
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +16 -0
- package/dist/actions/cvms/get_cvm_user_config.d.ts +92 -0
- package/dist/actions/cvms/provision_cvm.d.ts +26 -1
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +18 -0
- package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +93 -0
- package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +194 -0
- package/dist/actions/cvms/replicate_cvm.d.ts +126 -0
- package/dist/actions/cvms/restart_cvm.d.ts +2 -2
- package/dist/actions/cvms/shutdown_cvm.d.ts +2 -2
- package/dist/actions/cvms/start_cvm.d.ts +2 -2
- package/dist/actions/cvms/stop_cvm.d.ts +2 -2
- package/dist/actions/index.d.ts +20 -1
- package/dist/actions/kms/get_kms_onchain_detail.d.ts +688 -0
- package/dist/actions/os_images/get_os_images.d.ts +217 -0
- package/dist/actions/ssh_keys/create_ssh_key.d.ts +104 -0
- package/dist/actions/ssh_keys/delete_ssh_key.d.ts +65 -0
- package/dist/actions/ssh_keys/import_github_profile.d.ts +93 -0
- package/dist/actions/ssh_keys/list_ssh_keys.d.ts +101 -0
- package/dist/actions/ssh_keys/sync_github_ssh_keys.d.ts +78 -0
- package/dist/actions/workspaces/get_workspace.d.ts +2 -0
- package/dist/actions/workspaces/list_workspaces.d.ts +18 -0
- package/dist/create-client.d.ts +106 -0
- package/dist/index.js +1500 -322
- package/dist/index.mjs +1441 -320
- package/dist/types/app_compose.d.ts +5 -0
- package/dist/types/app_info_v20260121.d.ts +68 -0
- package/dist/types/cvm_info.d.ts +3 -3
- package/dist/types/cvm_info_v20260121.d.ts +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const OSImagePublicSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
slug: z.ZodString;
|
|
5
|
+
version: z.ZodString;
|
|
6
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
7
|
+
is_dev: z.ZodBoolean;
|
|
8
|
+
requires_gpu: z.ZodBoolean;
|
|
9
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
slug: z.ZodString;
|
|
12
|
+
version: z.ZodString;
|
|
13
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
14
|
+
is_dev: z.ZodBoolean;
|
|
15
|
+
requires_gpu: z.ZodBoolean;
|
|
16
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
slug: z.ZodString;
|
|
19
|
+
version: z.ZodString;
|
|
20
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
21
|
+
is_dev: z.ZodBoolean;
|
|
22
|
+
requires_gpu: z.ZodBoolean;
|
|
23
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
24
|
+
export type OSImagePublic = z.infer<typeof OSImagePublicSchema>;
|
|
25
|
+
export declare const GetOsImagesRequestSchema: z.ZodObject<{
|
|
26
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
page_size: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
is_dev: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}, "strict", z.ZodTypeAny, {
|
|
30
|
+
page?: number | undefined;
|
|
31
|
+
page_size?: number | undefined;
|
|
32
|
+
is_dev?: boolean | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
page?: number | undefined;
|
|
35
|
+
page_size?: number | undefined;
|
|
36
|
+
is_dev?: boolean | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
export type GetOsImagesRequest = z.infer<typeof GetOsImagesRequestSchema>;
|
|
39
|
+
export declare const GetOsImagesResponseSchema: z.ZodObject<{
|
|
40
|
+
items: z.ZodArray<z.ZodObject<{
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
slug: z.ZodString;
|
|
43
|
+
version: z.ZodString;
|
|
44
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
45
|
+
is_dev: z.ZodBoolean;
|
|
46
|
+
requires_gpu: z.ZodBoolean;
|
|
47
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
slug: z.ZodString;
|
|
50
|
+
version: z.ZodString;
|
|
51
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
52
|
+
is_dev: z.ZodBoolean;
|
|
53
|
+
requires_gpu: z.ZodBoolean;
|
|
54
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
slug: z.ZodString;
|
|
57
|
+
version: z.ZodString;
|
|
58
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
59
|
+
is_dev: z.ZodBoolean;
|
|
60
|
+
requires_gpu: z.ZodBoolean;
|
|
61
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
62
|
+
total: z.ZodNumber;
|
|
63
|
+
page: z.ZodNumber;
|
|
64
|
+
page_size: z.ZodNumber;
|
|
65
|
+
pages: z.ZodNumber;
|
|
66
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
67
|
+
items: z.ZodArray<z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
slug: z.ZodString;
|
|
70
|
+
version: z.ZodString;
|
|
71
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
72
|
+
is_dev: z.ZodBoolean;
|
|
73
|
+
requires_gpu: z.ZodBoolean;
|
|
74
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
75
|
+
name: z.ZodString;
|
|
76
|
+
slug: z.ZodString;
|
|
77
|
+
version: z.ZodString;
|
|
78
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
79
|
+
is_dev: z.ZodBoolean;
|
|
80
|
+
requires_gpu: z.ZodBoolean;
|
|
81
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
slug: z.ZodString;
|
|
84
|
+
version: z.ZodString;
|
|
85
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
86
|
+
is_dev: z.ZodBoolean;
|
|
87
|
+
requires_gpu: z.ZodBoolean;
|
|
88
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
89
|
+
total: z.ZodNumber;
|
|
90
|
+
page: z.ZodNumber;
|
|
91
|
+
page_size: z.ZodNumber;
|
|
92
|
+
pages: z.ZodNumber;
|
|
93
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
94
|
+
items: z.ZodArray<z.ZodObject<{
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
slug: z.ZodString;
|
|
97
|
+
version: z.ZodString;
|
|
98
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
99
|
+
is_dev: z.ZodBoolean;
|
|
100
|
+
requires_gpu: z.ZodBoolean;
|
|
101
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
slug: z.ZodString;
|
|
104
|
+
version: z.ZodString;
|
|
105
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
106
|
+
is_dev: z.ZodBoolean;
|
|
107
|
+
requires_gpu: z.ZodBoolean;
|
|
108
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
slug: z.ZodString;
|
|
111
|
+
version: z.ZodString;
|
|
112
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
113
|
+
is_dev: z.ZodBoolean;
|
|
114
|
+
requires_gpu: z.ZodBoolean;
|
|
115
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
116
|
+
total: z.ZodNumber;
|
|
117
|
+
page: z.ZodNumber;
|
|
118
|
+
page_size: z.ZodNumber;
|
|
119
|
+
pages: z.ZodNumber;
|
|
120
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
121
|
+
export type GetOsImagesResponse = z.infer<typeof GetOsImagesResponseSchema>;
|
|
122
|
+
declare const getOsImages: {
|
|
123
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: {
|
|
124
|
+
page?: number | undefined;
|
|
125
|
+
page_size?: number | undefined;
|
|
126
|
+
is_dev?: boolean | undefined;
|
|
127
|
+
} | undefined): Promise<z.objectOutputType<{
|
|
128
|
+
items: z.ZodArray<z.ZodObject<{
|
|
129
|
+
name: z.ZodString;
|
|
130
|
+
slug: z.ZodString;
|
|
131
|
+
version: z.ZodString;
|
|
132
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
133
|
+
is_dev: z.ZodBoolean;
|
|
134
|
+
requires_gpu: z.ZodBoolean;
|
|
135
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
136
|
+
name: z.ZodString;
|
|
137
|
+
slug: z.ZodString;
|
|
138
|
+
version: z.ZodString;
|
|
139
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
140
|
+
is_dev: z.ZodBoolean;
|
|
141
|
+
requires_gpu: z.ZodBoolean;
|
|
142
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
slug: z.ZodString;
|
|
145
|
+
version: z.ZodString;
|
|
146
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
147
|
+
is_dev: z.ZodBoolean;
|
|
148
|
+
requires_gpu: z.ZodBoolean;
|
|
149
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
150
|
+
total: z.ZodNumber;
|
|
151
|
+
page: z.ZodNumber;
|
|
152
|
+
page_size: z.ZodNumber;
|
|
153
|
+
pages: z.ZodNumber;
|
|
154
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
155
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: {
|
|
156
|
+
page?: number | undefined;
|
|
157
|
+
page_size?: number | undefined;
|
|
158
|
+
is_dev?: boolean | undefined;
|
|
159
|
+
} | undefined, parameters?: {
|
|
160
|
+
schema: T;
|
|
161
|
+
} | undefined): Promise<z.TypeOf<T>>;
|
|
162
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: {
|
|
163
|
+
page?: number | undefined;
|
|
164
|
+
page_size?: number | undefined;
|
|
165
|
+
is_dev?: boolean | undefined;
|
|
166
|
+
} | undefined, parameters?: {
|
|
167
|
+
schema: false;
|
|
168
|
+
} | undefined): Promise<unknown>;
|
|
169
|
+
}, safeGetOsImages: {
|
|
170
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: {
|
|
171
|
+
page?: number | undefined;
|
|
172
|
+
page_size?: number | undefined;
|
|
173
|
+
is_dev?: boolean | undefined;
|
|
174
|
+
} | undefined): Promise<import("../..").SafeResult<z.objectOutputType<{
|
|
175
|
+
items: z.ZodArray<z.ZodObject<{
|
|
176
|
+
name: z.ZodString;
|
|
177
|
+
slug: z.ZodString;
|
|
178
|
+
version: z.ZodString;
|
|
179
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
180
|
+
is_dev: z.ZodBoolean;
|
|
181
|
+
requires_gpu: z.ZodBoolean;
|
|
182
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
slug: z.ZodString;
|
|
185
|
+
version: z.ZodString;
|
|
186
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
187
|
+
is_dev: z.ZodBoolean;
|
|
188
|
+
requires_gpu: z.ZodBoolean;
|
|
189
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
190
|
+
name: z.ZodString;
|
|
191
|
+
slug: z.ZodString;
|
|
192
|
+
version: z.ZodString;
|
|
193
|
+
os_image_hash: z.ZodNullable<z.ZodString>;
|
|
194
|
+
is_dev: z.ZodBoolean;
|
|
195
|
+
requires_gpu: z.ZodBoolean;
|
|
196
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
197
|
+
total: z.ZodNumber;
|
|
198
|
+
page: z.ZodNumber;
|
|
199
|
+
page_size: z.ZodNumber;
|
|
200
|
+
pages: z.ZodNumber;
|
|
201
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
202
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: {
|
|
203
|
+
page?: number | undefined;
|
|
204
|
+
page_size?: number | undefined;
|
|
205
|
+
is_dev?: boolean | undefined;
|
|
206
|
+
} | undefined, parameters?: {
|
|
207
|
+
schema: T;
|
|
208
|
+
} | undefined): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
209
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params?: {
|
|
210
|
+
page?: number | undefined;
|
|
211
|
+
page_size?: number | undefined;
|
|
212
|
+
is_dev?: boolean | undefined;
|
|
213
|
+
} | undefined, parameters?: {
|
|
214
|
+
schema: false;
|
|
215
|
+
} | undefined): Promise<import("../..").SafeResult<unknown>>;
|
|
216
|
+
};
|
|
217
|
+
export { getOsImages, safeGetOsImages };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CreateSshKeyRequestSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
public_key: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
name: string;
|
|
7
|
+
public_key: string;
|
|
8
|
+
}, {
|
|
9
|
+
name: string;
|
|
10
|
+
public_key: string;
|
|
11
|
+
}>;
|
|
12
|
+
export type CreateSshKeyRequest = z.infer<typeof CreateSshKeyRequestSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new SSH key for the current user
|
|
15
|
+
*
|
|
16
|
+
* Adds a manually-provided public key. The server computes the SHA256
|
|
17
|
+
* fingerprint and detects the key type automatically.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { createClient, createSshKey } from '@phala/cloud'
|
|
22
|
+
*
|
|
23
|
+
* const client = createClient({ apiKey: 'your-api-key' })
|
|
24
|
+
* const key = await createSshKey(client, {
|
|
25
|
+
* name: 'my-laptop',
|
|
26
|
+
* public_key: 'ssh-ed25519 AAAA...',
|
|
27
|
+
* })
|
|
28
|
+
* console.log(key.fingerprint)
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* ## Safe Version
|
|
32
|
+
*
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const result = await safeCreateSshKey(client, {
|
|
35
|
+
* name: 'my-laptop',
|
|
36
|
+
* public_key: 'ssh-ed25519 AAAA...',
|
|
37
|
+
* })
|
|
38
|
+
* if (result.success) {
|
|
39
|
+
* console.log('Created key:', result.data.id)
|
|
40
|
+
* } else {
|
|
41
|
+
* console.error(result.error.message)
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const createSshKey: {
|
|
46
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
47
|
+
name: string;
|
|
48
|
+
public_key: string;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
name: string;
|
|
51
|
+
id: string;
|
|
52
|
+
source: string;
|
|
53
|
+
updated_at: string;
|
|
54
|
+
created_at: string;
|
|
55
|
+
user_id: string;
|
|
56
|
+
public_key: string;
|
|
57
|
+
fingerprint: string;
|
|
58
|
+
key_type: string;
|
|
59
|
+
key_metadata?: Record<string, unknown> | null | undefined;
|
|
60
|
+
last_synced_at?: string | null | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
63
|
+
name: string;
|
|
64
|
+
public_key: string;
|
|
65
|
+
}, parameters: {
|
|
66
|
+
schema: T;
|
|
67
|
+
}): Promise<z.TypeOf<T>>;
|
|
68
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
69
|
+
name: string;
|
|
70
|
+
public_key: string;
|
|
71
|
+
}, parameters: {
|
|
72
|
+
schema: false;
|
|
73
|
+
}): Promise<unknown>;
|
|
74
|
+
}, safeCreateSshKey: {
|
|
75
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
76
|
+
name: string;
|
|
77
|
+
public_key: string;
|
|
78
|
+
}): Promise<import("../..").SafeResult<{
|
|
79
|
+
name: string;
|
|
80
|
+
id: string;
|
|
81
|
+
source: string;
|
|
82
|
+
updated_at: string;
|
|
83
|
+
created_at: string;
|
|
84
|
+
user_id: string;
|
|
85
|
+
public_key: string;
|
|
86
|
+
fingerprint: string;
|
|
87
|
+
key_type: string;
|
|
88
|
+
key_metadata?: Record<string, unknown> | null | undefined;
|
|
89
|
+
last_synced_at?: string | null | undefined;
|
|
90
|
+
}>>;
|
|
91
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
92
|
+
name: string;
|
|
93
|
+
public_key: string;
|
|
94
|
+
}, parameters: {
|
|
95
|
+
schema: T;
|
|
96
|
+
}): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
97
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
98
|
+
name: string;
|
|
99
|
+
public_key: string;
|
|
100
|
+
}, parameters: {
|
|
101
|
+
schema: false;
|
|
102
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
103
|
+
};
|
|
104
|
+
export { createSshKey, safeCreateSshKey };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DeleteSshKeyRequestSchema: z.ZodObject<{
|
|
3
|
+
keyId: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
keyId: string;
|
|
6
|
+
}, {
|
|
7
|
+
keyId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type DeleteSshKeyRequest = z.infer<typeof DeleteSshKeyRequestSchema>;
|
|
10
|
+
/**
|
|
11
|
+
* Delete an SSH key
|
|
12
|
+
*
|
|
13
|
+
* Permanently removes an SSH key from the current user's account.
|
|
14
|
+
* This operation cannot be undone.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { createClient, deleteSshKey } from '@phala/cloud'
|
|
19
|
+
*
|
|
20
|
+
* const client = createClient({ apiKey: 'your-api-key' })
|
|
21
|
+
* await deleteSshKey(client, { keyId: 'sshkey_xxx' })
|
|
22
|
+
* console.log('Key deleted')
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ## Safe Version
|
|
26
|
+
*
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const result = await safeDeleteSshKey(client, { keyId: 'sshkey_xxx' })
|
|
29
|
+
* if (result.success) {
|
|
30
|
+
* console.log('Key deleted')
|
|
31
|
+
* } else {
|
|
32
|
+
* console.error(result.error.message)
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const deleteSshKey: {
|
|
37
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
38
|
+
keyId: string;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
41
|
+
keyId: string;
|
|
42
|
+
}, parameters: {
|
|
43
|
+
schema: T;
|
|
44
|
+
}): Promise<z.TypeOf<T>>;
|
|
45
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
46
|
+
keyId: string;
|
|
47
|
+
}, parameters: {
|
|
48
|
+
schema: false;
|
|
49
|
+
}): Promise<unknown>;
|
|
50
|
+
}, safeDeleteSshKey: {
|
|
51
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
52
|
+
keyId: string;
|
|
53
|
+
}): Promise<import("../..").SafeResult<void>>;
|
|
54
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
55
|
+
keyId: string;
|
|
56
|
+
}, parameters: {
|
|
57
|
+
schema: T;
|
|
58
|
+
}): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
59
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
60
|
+
keyId: string;
|
|
61
|
+
}, parameters: {
|
|
62
|
+
schema: false;
|
|
63
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
64
|
+
};
|
|
65
|
+
export { deleteSshKey, safeDeleteSshKey };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ImportGithubProfileRequestSchema: z.ZodObject<{
|
|
3
|
+
github_username: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
github_username: string;
|
|
6
|
+
}, {
|
|
7
|
+
github_username: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type ImportGithubProfileRequest = z.infer<typeof ImportGithubProfileRequestSchema>;
|
|
10
|
+
export declare const ImportGithubProfileResponseSchema: z.ZodObject<{
|
|
11
|
+
github_username: z.ZodString;
|
|
12
|
+
keys_added: z.ZodNumber;
|
|
13
|
+
keys_skipped: z.ZodNumber;
|
|
14
|
+
errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
errors: string[];
|
|
17
|
+
github_username: string;
|
|
18
|
+
keys_added: number;
|
|
19
|
+
keys_skipped: number;
|
|
20
|
+
}, {
|
|
21
|
+
github_username: string;
|
|
22
|
+
keys_added: number;
|
|
23
|
+
keys_skipped: number;
|
|
24
|
+
errors?: string[] | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export type ImportGithubProfileResponse = z.infer<typeof ImportGithubProfileResponseSchema>;
|
|
27
|
+
/**
|
|
28
|
+
* Import SSH keys from a GitHub user's public profile
|
|
29
|
+
*
|
|
30
|
+
* Fetches public SSH keys from any GitHub user's profile via the unauthenticated
|
|
31
|
+
* GitHub API. Keys already present (matched by SHA256 fingerprint) are skipped.
|
|
32
|
+
* Per-key parse errors are collected in `errors` rather than aborting the import.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { createClient, importGithubProfileSshKeys } from '@phala/cloud'
|
|
37
|
+
*
|
|
38
|
+
* const client = createClient({ apiKey: 'your-api-key' })
|
|
39
|
+
* const result = await importGithubProfileSshKeys(client, { github_username: 'octocat' })
|
|
40
|
+
* console.log(`Added: ${result.keys_added}, Skipped: ${result.keys_skipped}`)
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* ## Safe Version
|
|
44
|
+
*
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const result = await safeImportGithubProfileSshKeys(client, { github_username: 'octocat' })
|
|
47
|
+
* if (result.success) {
|
|
48
|
+
* console.log('Added', result.data.keys_added, 'key(s)')
|
|
49
|
+
* } else {
|
|
50
|
+
* console.error(result.error.message)
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare const importGithubProfileSshKeys: {
|
|
55
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
56
|
+
github_username: string;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
errors: string[];
|
|
59
|
+
github_username: string;
|
|
60
|
+
keys_added: number;
|
|
61
|
+
keys_skipped: number;
|
|
62
|
+
}>;
|
|
63
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
64
|
+
github_username: string;
|
|
65
|
+
}, parameters: {
|
|
66
|
+
schema: T;
|
|
67
|
+
}): Promise<z.TypeOf<T>>;
|
|
68
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
69
|
+
github_username: string;
|
|
70
|
+
}, parameters: {
|
|
71
|
+
schema: false;
|
|
72
|
+
}): Promise<unknown>;
|
|
73
|
+
}, safeImportGithubProfileSshKeys: {
|
|
74
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
75
|
+
github_username: string;
|
|
76
|
+
}): Promise<import("../..").SafeResult<{
|
|
77
|
+
errors: string[];
|
|
78
|
+
github_username: string;
|
|
79
|
+
keys_added: number;
|
|
80
|
+
keys_skipped: number;
|
|
81
|
+
}>>;
|
|
82
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
83
|
+
github_username: string;
|
|
84
|
+
}, parameters: {
|
|
85
|
+
schema: T;
|
|
86
|
+
}): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
87
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, params: {
|
|
88
|
+
github_username: string;
|
|
89
|
+
}, parameters: {
|
|
90
|
+
schema: false;
|
|
91
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
92
|
+
};
|
|
93
|
+
export { importGithubProfileSshKeys, safeImportGithubProfileSshKeys };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Client, SafeResult } from "../../client";
|
|
3
|
+
import type { ApiVersion } from "../../types/client";
|
|
4
|
+
export declare const SshKeySchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
user_id: z.ZodString;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
public_key: z.ZodString;
|
|
9
|
+
fingerprint: z.ZodString;
|
|
10
|
+
key_type: z.ZodString;
|
|
11
|
+
source: z.ZodString;
|
|
12
|
+
key_metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
13
|
+
last_synced_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
created_at: z.ZodString;
|
|
15
|
+
updated_at: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
name: string;
|
|
18
|
+
id: string;
|
|
19
|
+
source: string;
|
|
20
|
+
updated_at: string;
|
|
21
|
+
created_at: string;
|
|
22
|
+
user_id: string;
|
|
23
|
+
public_key: string;
|
|
24
|
+
fingerprint: string;
|
|
25
|
+
key_type: string;
|
|
26
|
+
key_metadata?: Record<string, unknown> | null | undefined;
|
|
27
|
+
last_synced_at?: string | null | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
source: string;
|
|
32
|
+
updated_at: string;
|
|
33
|
+
created_at: string;
|
|
34
|
+
user_id: string;
|
|
35
|
+
public_key: string;
|
|
36
|
+
fingerprint: string;
|
|
37
|
+
key_type: string;
|
|
38
|
+
key_metadata?: Record<string, unknown> | null | undefined;
|
|
39
|
+
last_synced_at?: string | null | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export type SshKey = z.infer<typeof SshKeySchema>;
|
|
42
|
+
export declare const ListSshKeysResponseSchema: z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
user_id: z.ZodString;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
public_key: z.ZodString;
|
|
47
|
+
fingerprint: z.ZodString;
|
|
48
|
+
key_type: z.ZodString;
|
|
49
|
+
source: z.ZodString;
|
|
50
|
+
key_metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
51
|
+
last_synced_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
created_at: z.ZodString;
|
|
53
|
+
updated_at: z.ZodString;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
name: string;
|
|
56
|
+
id: string;
|
|
57
|
+
source: string;
|
|
58
|
+
updated_at: string;
|
|
59
|
+
created_at: string;
|
|
60
|
+
user_id: string;
|
|
61
|
+
public_key: string;
|
|
62
|
+
fingerprint: string;
|
|
63
|
+
key_type: string;
|
|
64
|
+
key_metadata?: Record<string, unknown> | null | undefined;
|
|
65
|
+
last_synced_at?: string | null | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
name: string;
|
|
68
|
+
id: string;
|
|
69
|
+
source: string;
|
|
70
|
+
updated_at: string;
|
|
71
|
+
created_at: string;
|
|
72
|
+
user_id: string;
|
|
73
|
+
public_key: string;
|
|
74
|
+
fingerprint: string;
|
|
75
|
+
key_type: string;
|
|
76
|
+
key_metadata?: Record<string, unknown> | null | undefined;
|
|
77
|
+
last_synced_at?: string | null | undefined;
|
|
78
|
+
}>, "many">;
|
|
79
|
+
export type ListSshKeysResponse = z.infer<typeof ListSshKeysResponseSchema>;
|
|
80
|
+
/**
|
|
81
|
+
* List SSH keys for the current user
|
|
82
|
+
*
|
|
83
|
+
* Returns all active (non-revoked) SSH keys belonging to the authenticated user,
|
|
84
|
+
* ordered by creation date descending.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* import { createClient, listSshKeys } from '@phala/cloud'
|
|
89
|
+
*
|
|
90
|
+
* const client = createClient({ apiKey: 'your-api-key' })
|
|
91
|
+
* const keys = await listSshKeys(client)
|
|
92
|
+
* for (const key of keys) {
|
|
93
|
+
* console.log(key.name, key.key_type, key.fingerprint)
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function listSshKeys(client: Client<ApiVersion>): Promise<ListSshKeysResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Safe version of listSshKeys that returns a SafeResult instead of throwing
|
|
100
|
+
*/
|
|
101
|
+
export declare function safeListSshKeys(client: Client<ApiVersion>): Promise<SafeResult<ListSshKeysResponse>>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SyncGithubSshKeysResponseSchema: z.ZodObject<{
|
|
3
|
+
synced_count: z.ZodNumber;
|
|
4
|
+
keys_added: z.ZodNumber;
|
|
5
|
+
keys_updated: z.ZodNumber;
|
|
6
|
+
keys_removed: z.ZodNumber;
|
|
7
|
+
errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
errors: string[];
|
|
10
|
+
keys_added: number;
|
|
11
|
+
synced_count: number;
|
|
12
|
+
keys_updated: number;
|
|
13
|
+
keys_removed: number;
|
|
14
|
+
}, {
|
|
15
|
+
keys_added: number;
|
|
16
|
+
synced_count: number;
|
|
17
|
+
keys_updated: number;
|
|
18
|
+
keys_removed: number;
|
|
19
|
+
errors?: string[] | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export type SyncGithubSshKeysResponse = z.infer<typeof SyncGithubSshKeysResponseSchema>;
|
|
22
|
+
/**
|
|
23
|
+
* Sync SSH keys from the user's linked GitHub account
|
|
24
|
+
*
|
|
25
|
+
* Fetches SSH keys from the authenticated user's linked GitHub account and
|
|
26
|
+
* synchronises them. New keys are added, existing keys are updated, and
|
|
27
|
+
* keys removed from GitHub are revoked locally.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { createClient, syncGithubSshKeys } from '@phala/cloud'
|
|
32
|
+
*
|
|
33
|
+
* const client = createClient({ apiKey: 'your-api-key' })
|
|
34
|
+
* const result = await syncGithubSshKeys(client)
|
|
35
|
+
* console.log(`Added: ${result.keys_added}, Removed: ${result.keys_removed}`)
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* ## Safe Version
|
|
39
|
+
*
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const result = await safeSyncGithubSshKeys(client)
|
|
42
|
+
* if (result.success) {
|
|
43
|
+
* console.log('Synced', result.data.synced_count, 'key(s)')
|
|
44
|
+
* } else {
|
|
45
|
+
* console.error(result.error.message)
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare const syncGithubSshKeys: {
|
|
50
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, parameters: {
|
|
51
|
+
schema: false;
|
|
52
|
+
}): Promise<unknown>;
|
|
53
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, parameters: {
|
|
54
|
+
schema: T;
|
|
55
|
+
}): Promise<z.TypeOf<T>>;
|
|
56
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>): Promise<{
|
|
57
|
+
errors: string[];
|
|
58
|
+
keys_added: number;
|
|
59
|
+
synced_count: number;
|
|
60
|
+
keys_updated: number;
|
|
61
|
+
keys_removed: number;
|
|
62
|
+
}>;
|
|
63
|
+
}, safeSyncGithubSshKeys: {
|
|
64
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>, parameters: {
|
|
65
|
+
schema: false;
|
|
66
|
+
}): Promise<import("../..").SafeResult<unknown>>;
|
|
67
|
+
<T extends z.ZodTypeAny>(client: import("../..").BaseClient<import("../..").ApiVersion>, parameters: {
|
|
68
|
+
schema: T;
|
|
69
|
+
}): Promise<import("../..").SafeResult<z.TypeOf<T>>>;
|
|
70
|
+
(client: import("../..").BaseClient<import("../..").ApiVersion>): Promise<import("../..").SafeResult<{
|
|
71
|
+
errors: string[];
|
|
72
|
+
keys_added: number;
|
|
73
|
+
synced_count: number;
|
|
74
|
+
keys_updated: number;
|
|
75
|
+
keys_removed: number;
|
|
76
|
+
}>>;
|
|
77
|
+
};
|
|
78
|
+
export { syncGithubSshKeys, safeSyncGithubSshKeys };
|
|
@@ -72,6 +72,7 @@ declare const getWorkspace: {
|
|
|
72
72
|
role: z.ZodString;
|
|
73
73
|
is_default: z.ZodBoolean;
|
|
74
74
|
created_at: z.ZodString;
|
|
75
|
+
confidential_models_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
75
76
|
}, z.ZodTypeAny, "passthrough">>;
|
|
76
77
|
<T extends z.ZodTypeAny>(client: Client<import("../..").ApiVersion>, params: string, parameters: {
|
|
77
78
|
schema: T;
|
|
@@ -88,6 +89,7 @@ declare const getWorkspace: {
|
|
|
88
89
|
role: z.ZodString;
|
|
89
90
|
is_default: z.ZodBoolean;
|
|
90
91
|
created_at: z.ZodString;
|
|
92
|
+
confidential_models_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
91
93
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
92
94
|
<T extends z.ZodTypeAny>(client: Client<import("../..").ApiVersion>, params: string, parameters: {
|
|
93
95
|
schema: T;
|