@phala/cloud 0.0.10 → 0.0.11
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/commit_cvm_compose_file_update.d.ts +15 -1
- package/dist/actions/commit_cvm_compose_file_update.d.ts.map +1 -1
- package/dist/actions/get_cvm_compose_file.d.ts +2 -70
- package/dist/actions/get_cvm_compose_file.d.ts.map +1 -1
- package/dist/actions/index.d.ts +4 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/list-instance-types.d.ts +146 -0
- package/dist/actions/list-instance-types.d.ts.map +1 -0
- package/dist/actions/provision_cvm_compose_file_update.d.ts +77 -25
- package/dist/actions/provision_cvm_compose_file_update.d.ts.map +1 -1
- package/dist/actions/workspaces/get_workspace.d.ts +72 -0
- package/dist/actions/workspaces/get_workspace.d.ts.map +1 -0
- package/dist/actions/workspaces/list_workspaces.d.ts +219 -0
- package/dist/actions/workspaces/list_workspaces.d.ts.map +1 -0
- package/dist/index.js +240 -77
- package/dist/index.mjs +229 -76
- package/dist/types/app_compose.d.ts +37 -0
- package/dist/types/app_compose.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type Client, type SafeResult } from "../../client";
|
|
3
|
+
import { ActionParameters, ActionReturnType } from "../../types/common";
|
|
4
|
+
/**
|
|
5
|
+
* List workspaces accessible by the current user
|
|
6
|
+
*
|
|
7
|
+
* Returns a paginated list of workspaces with their basic information.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createClient, listWorkspaces } from '@phala/cloud'
|
|
12
|
+
*
|
|
13
|
+
* const client = createClient({ apiKey: 'your-api-key' })
|
|
14
|
+
* const workspaces = await listWorkspaces(client)
|
|
15
|
+
* // Output: { data: [{ id: '...', name: '...', ... }], pagination: { ... } }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* ## Returns
|
|
19
|
+
*
|
|
20
|
+
* `ListWorkspaces | unknown`
|
|
21
|
+
*
|
|
22
|
+
* Information about accessible workspaces. Return type depends on schema parameter.
|
|
23
|
+
*
|
|
24
|
+
* ## Parameters
|
|
25
|
+
*
|
|
26
|
+
* ### parameters (optional)
|
|
27
|
+
* - **Type:** `ListWorkspacesParameters`
|
|
28
|
+
*
|
|
29
|
+
* Optional behavior parameters for schema validation and pagination.
|
|
30
|
+
*
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // Use default schema
|
|
33
|
+
* const workspaces = await listWorkspaces(client)
|
|
34
|
+
*
|
|
35
|
+
* // Return raw data without validation
|
|
36
|
+
* const raw = await listWorkspaces(client, { schema: false })
|
|
37
|
+
*
|
|
38
|
+
* // Use custom schema
|
|
39
|
+
* const customSchema = z.object({ data: z.array(z.object({ id: z.string() })) })
|
|
40
|
+
* const custom = await listWorkspaces(client, { schema: customSchema })
|
|
41
|
+
*
|
|
42
|
+
* // With pagination
|
|
43
|
+
* const page = await listWorkspaces(client, { limit: 20, cursor: 'next-page-cursor' })
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ## Safe Version
|
|
47
|
+
*
|
|
48
|
+
* Use `safeListWorkspaces` for error handling without exceptions:
|
|
49
|
+
*
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { safeListWorkspaces } from '@phala/cloud'
|
|
52
|
+
*
|
|
53
|
+
* const result = await safeListWorkspaces(client)
|
|
54
|
+
* if (result.success) {
|
|
55
|
+
* console.log(result.data.data[0].name)
|
|
56
|
+
* } else {
|
|
57
|
+
* if ("isRequestError" in result.error) {
|
|
58
|
+
* console.error(`HTTP ${result.error.status}: ${result.error.message}`)
|
|
59
|
+
* } else {
|
|
60
|
+
* console.error(`Validation error: ${result.error.issues}`)
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const WorkspaceResponseSchema: z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
69
|
+
tier: z.ZodString;
|
|
70
|
+
role: z.ZodString;
|
|
71
|
+
created_at: z.ZodString;
|
|
72
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
name: z.ZodString;
|
|
75
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
76
|
+
tier: z.ZodString;
|
|
77
|
+
role: z.ZodString;
|
|
78
|
+
created_at: z.ZodString;
|
|
79
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
83
|
+
tier: z.ZodString;
|
|
84
|
+
role: z.ZodString;
|
|
85
|
+
created_at: z.ZodString;
|
|
86
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
87
|
+
export declare const PaginationMetadataSchema: z.ZodObject<{
|
|
88
|
+
has_more: z.ZodBoolean;
|
|
89
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
90
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
91
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
92
|
+
has_more: z.ZodBoolean;
|
|
93
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
94
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
95
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
96
|
+
has_more: z.ZodBoolean;
|
|
97
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
98
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
99
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
100
|
+
export declare const ListWorkspacesSchema: z.ZodObject<{
|
|
101
|
+
data: z.ZodArray<z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
105
|
+
tier: z.ZodString;
|
|
106
|
+
role: z.ZodString;
|
|
107
|
+
created_at: z.ZodString;
|
|
108
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
112
|
+
tier: z.ZodString;
|
|
113
|
+
role: z.ZodString;
|
|
114
|
+
created_at: z.ZodString;
|
|
115
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
name: z.ZodString;
|
|
118
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
119
|
+
tier: z.ZodString;
|
|
120
|
+
role: z.ZodString;
|
|
121
|
+
created_at: z.ZodString;
|
|
122
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
123
|
+
pagination: z.ZodObject<{
|
|
124
|
+
has_more: z.ZodBoolean;
|
|
125
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
126
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
127
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
128
|
+
has_more: z.ZodBoolean;
|
|
129
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
130
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
131
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
132
|
+
has_more: z.ZodBoolean;
|
|
133
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
134
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
135
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
136
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
137
|
+
data: z.ZodArray<z.ZodObject<{
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
141
|
+
tier: z.ZodString;
|
|
142
|
+
role: z.ZodString;
|
|
143
|
+
created_at: z.ZodString;
|
|
144
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
145
|
+
id: z.ZodString;
|
|
146
|
+
name: z.ZodString;
|
|
147
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
148
|
+
tier: z.ZodString;
|
|
149
|
+
role: z.ZodString;
|
|
150
|
+
created_at: z.ZodString;
|
|
151
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
155
|
+
tier: z.ZodString;
|
|
156
|
+
role: z.ZodString;
|
|
157
|
+
created_at: z.ZodString;
|
|
158
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
159
|
+
pagination: z.ZodObject<{
|
|
160
|
+
has_more: z.ZodBoolean;
|
|
161
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
162
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
163
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
164
|
+
has_more: z.ZodBoolean;
|
|
165
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
166
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
167
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
168
|
+
has_more: z.ZodBoolean;
|
|
169
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
170
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
171
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
172
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
173
|
+
data: z.ZodArray<z.ZodObject<{
|
|
174
|
+
id: z.ZodString;
|
|
175
|
+
name: z.ZodString;
|
|
176
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
177
|
+
tier: z.ZodString;
|
|
178
|
+
role: z.ZodString;
|
|
179
|
+
created_at: z.ZodString;
|
|
180
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
181
|
+
id: z.ZodString;
|
|
182
|
+
name: z.ZodString;
|
|
183
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
184
|
+
tier: z.ZodString;
|
|
185
|
+
role: z.ZodString;
|
|
186
|
+
created_at: z.ZodString;
|
|
187
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
name: z.ZodString;
|
|
190
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
191
|
+
tier: z.ZodString;
|
|
192
|
+
role: z.ZodString;
|
|
193
|
+
created_at: z.ZodString;
|
|
194
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
195
|
+
pagination: z.ZodObject<{
|
|
196
|
+
has_more: z.ZodBoolean;
|
|
197
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
198
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
199
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
200
|
+
has_more: z.ZodBoolean;
|
|
201
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
202
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
203
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
204
|
+
has_more: z.ZodBoolean;
|
|
205
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
206
|
+
total: z.ZodNullable<z.ZodNumber>;
|
|
207
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
208
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
209
|
+
export type WorkspaceResponse = z.infer<typeof WorkspaceResponseSchema>;
|
|
210
|
+
export type PaginationMetadata = z.infer<typeof PaginationMetadataSchema>;
|
|
211
|
+
export type ListWorkspaces = z.infer<typeof ListWorkspacesSchema>;
|
|
212
|
+
export type ListWorkspacesParameters<T = undefined> = ActionParameters<T> & {
|
|
213
|
+
cursor?: string;
|
|
214
|
+
limit?: number;
|
|
215
|
+
};
|
|
216
|
+
export type ListWorkspacesReturnType<T = undefined> = ActionReturnType<ListWorkspaces, T>;
|
|
217
|
+
export declare function listWorkspaces<T extends z.ZodSchema | false | undefined = undefined>(client: Client, parameters?: ListWorkspacesParameters<T>): Promise<ListWorkspacesReturnType<T>>;
|
|
218
|
+
export declare function safeListWorkspaces<T extends z.ZodSchema | false | undefined = undefined>(client: Client, parameters?: ListWorkspacesParameters<T>): Promise<SafeResult<ListWorkspacesReturnType<T>>>;
|
|
219
|
+
//# sourceMappingURL=list_workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_workspaces.d.ts","sourceRoot":"","sources":["../../../src/actions/workspaces/list_workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;gCASpB,CAAC;AAEjB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;gCAMrB,CAAC;AAEjB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAKjB,CAAC;AAEjB,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,MAAM,MAAM,wBAAwB,CAAC,CAAC,GAAG,SAAS,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,GAAG,SAAS,IAAI,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;AAE1F,wBAAsB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,EACxF,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAiBtC;AAED,wBAAsB,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,EAC5F,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,CAuBlD"}
|