@tarkahq/sdk 0.0.0-stage → 0.3.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/LICENSE +201 -0
- package/NOTICE +69 -0
- package/README.md +700 -2
- package/api-source.json +38 -0
- package/dist/cjs/client.d.ts +114 -0
- package/dist/cjs/client.js +174 -0
- package/dist/cjs/errors.d.ts +27 -0
- package/dist/cjs/errors.js +78 -0
- package/dist/cjs/generated/google/api/annotations.d.ts +1 -0
- package/dist/cjs/generated/google/api/annotations.js +10 -0
- package/dist/cjs/generated/google/api/http.d.ts +395 -0
- package/dist/cjs/generated/google/api/http.js +421 -0
- package/dist/cjs/generated/google/protobuf/descriptor.d.ts +873 -0
- package/dist/cjs/generated/google/protobuf/descriptor.js +3992 -0
- package/dist/cjs/generated/google/protobuf/empty.d.ts +35 -0
- package/dist/cjs/generated/google/protobuf/empty.js +58 -0
- package/dist/cjs/generated/google/protobuf/struct.d.ts +127 -0
- package/dist/cjs/generated/google/protobuf/struct.js +529 -0
- package/dist/cjs/generated/google/protobuf/timestamp.d.ts +128 -0
- package/dist/cjs/generated/google/protobuf/timestamp.js +95 -0
- package/dist/cjs/generated/protoc-gen-openapiv2/options/annotations.d.ts +1 -0
- package/dist/cjs/generated/protoc-gen-openapiv2/options/annotations.js +10 -0
- package/dist/cjs/generated/protoc-gen-openapiv2/options/openapiv2.d.ts +983 -0
- package/dist/cjs/generated/protoc-gen-openapiv2/options/openapiv2.js +4874 -0
- package/dist/cjs/generated/tarka/access/v1/access.d.ts +322 -0
- package/dist/cjs/generated/tarka/access/v1/access.js +2979 -0
- package/dist/cjs/generated/tarka/channels/v1/channels.d.ts +370 -0
- package/dist/cjs/generated/tarka/channels/v1/channels.js +3603 -0
- package/dist/cjs/generated/tarka/gateway/v1/gateway.d.ts +804 -0
- package/dist/cjs/generated/tarka/gateway/v1/gateway.js +8081 -0
- package/dist/cjs/generated/tarka/iam/v1/iam.d.ts +1291 -0
- package/dist/cjs/generated/tarka/iam/v1/iam.js +13207 -0
- package/dist/cjs/generated/tarka/inference/v1/inference.d.ts +699 -0
- package/dist/cjs/generated/tarka/inference/v1/inference.js +7058 -0
- package/dist/cjs/generated/tarka/provisioning/v1/agent_secrets.d.ts +70 -0
- package/dist/cjs/generated/tarka/provisioning/v1/agent_secrets.js +603 -0
- package/dist/cjs/generated/tarka/provisioning/v1/billing_quote.d.ts +171 -0
- package/dist/cjs/generated/tarka/provisioning/v1/billing_quote.js +1588 -0
- package/dist/cjs/generated/tarka/provisioning/v1/job.d.ts +168 -0
- package/dist/cjs/generated/tarka/provisioning/v1/job.js +1505 -0
- package/dist/cjs/generated/tarka/provisioning/v1/provisioning.d.ts +2644 -0
- package/dist/cjs/generated/tarka/provisioning/v1/provisioning.js +19501 -0
- package/dist/cjs/generated/tarka/provisioning/v1/registry_credentials.d.ts +89 -0
- package/dist/cjs/generated/tarka/provisioning/v1/registry_credentials.js +856 -0
- package/dist/cjs/generated/tarka/provisioning/v1/sandbox.d.ts +431 -0
- package/dist/cjs/generated/tarka/provisioning/v1/sandbox.js +3203 -0
- package/dist/cjs/generated/tarka/provisioning/v1/source_builds.d.ts +291 -0
- package/dist/cjs/generated/tarka/provisioning/v1/source_builds.js +3920 -0
- package/dist/cjs/grpc.d.ts +12 -0
- package/dist/cjs/grpc.js +55 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/resources/inference.d.ts +293 -0
- package/dist/cjs/resources/inference.js +451 -0
- package/dist/cjs/resources/provisioning.d.ts +389 -0
- package/dist/cjs/resources/provisioning.js +552 -0
- package/dist/cjs/resources/sandboxes.d.ts +360 -0
- package/dist/cjs/resources/sandboxes.js +732 -0
- package/dist/cjs/rpc-types.d.ts +36 -0
- package/dist/cjs/rpc-types.js +29 -0
- package/dist/cjs/runtime.d.ts +99 -0
- package/dist/cjs/runtime.js +473 -0
- package/dist/cjs/transport.d.ts +60 -0
- package/dist/cjs/transport.js +114 -0
- package/dist/cjs/types.d.ts +309 -0
- package/dist/cjs/types.js +2 -0
- package/dist/esm/client.d.ts +114 -0
- package/dist/esm/client.js +169 -0
- package/dist/esm/errors.d.ts +27 -0
- package/dist/esm/errors.js +71 -0
- package/dist/esm/generated/google/api/annotations.d.ts +1 -0
- package/dist/esm/generated/google/api/annotations.js +7 -0
- package/dist/esm/generated/google/api/http.d.ts +395 -0
- package/dist/esm/generated/google/api/http.js +418 -0
- package/dist/esm/generated/google/protobuf/descriptor.d.ts +873 -0
- package/dist/esm/generated/google/protobuf/descriptor.js +3977 -0
- package/dist/esm/generated/google/protobuf/empty.d.ts +35 -0
- package/dist/esm/generated/google/protobuf/empty.js +55 -0
- package/dist/esm/generated/google/protobuf/struct.d.ts +127 -0
- package/dist/esm/generated/google/protobuf/struct.js +524 -0
- package/dist/esm/generated/google/protobuf/timestamp.d.ts +128 -0
- package/dist/esm/generated/google/protobuf/timestamp.js +92 -0
- package/dist/esm/generated/protoc-gen-openapiv2/options/annotations.d.ts +1 -0
- package/dist/esm/generated/protoc-gen-openapiv2/options/annotations.js +7 -0
- package/dist/esm/generated/protoc-gen-openapiv2/options/openapiv2.d.ts +983 -0
- package/dist/esm/generated/protoc-gen-openapiv2/options/openapiv2.js +4859 -0
- package/dist/esm/generated/tarka/access/v1/access.d.ts +322 -0
- package/dist/esm/generated/tarka/access/v1/access.js +2976 -0
- package/dist/esm/generated/tarka/channels/v1/channels.d.ts +370 -0
- package/dist/esm/generated/tarka/channels/v1/channels.js +3600 -0
- package/dist/esm/generated/tarka/gateway/v1/gateway.d.ts +804 -0
- package/dist/esm/generated/tarka/gateway/v1/gateway.js +8077 -0
- package/dist/esm/generated/tarka/iam/v1/iam.d.ts +1291 -0
- package/dist/esm/generated/tarka/iam/v1/iam.js +13203 -0
- package/dist/esm/generated/tarka/inference/v1/inference.d.ts +699 -0
- package/dist/esm/generated/tarka/inference/v1/inference.js +7055 -0
- package/dist/esm/generated/tarka/provisioning/v1/agent_secrets.d.ts +70 -0
- package/dist/esm/generated/tarka/provisioning/v1/agent_secrets.js +600 -0
- package/dist/esm/generated/tarka/provisioning/v1/billing_quote.d.ts +171 -0
- package/dist/esm/generated/tarka/provisioning/v1/billing_quote.js +1585 -0
- package/dist/esm/generated/tarka/provisioning/v1/job.d.ts +168 -0
- package/dist/esm/generated/tarka/provisioning/v1/job.js +1500 -0
- package/dist/esm/generated/tarka/provisioning/v1/provisioning.d.ts +2644 -0
- package/dist/esm/generated/tarka/provisioning/v1/provisioning.js +19496 -0
- package/dist/esm/generated/tarka/provisioning/v1/registry_credentials.d.ts +89 -0
- package/dist/esm/generated/tarka/provisioning/v1/registry_credentials.js +853 -0
- package/dist/esm/generated/tarka/provisioning/v1/sandbox.d.ts +431 -0
- package/dist/esm/generated/tarka/provisioning/v1/sandbox.js +3192 -0
- package/dist/esm/generated/tarka/provisioning/v1/source_builds.d.ts +291 -0
- package/dist/esm/generated/tarka/provisioning/v1/source_builds.js +3917 -0
- package/dist/esm/grpc.d.ts +12 -0
- package/dist/esm/grpc.js +11 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/resources/inference.d.ts +293 -0
- package/dist/esm/resources/inference.js +437 -0
- package/dist/esm/resources/provisioning.d.ts +389 -0
- package/dist/esm/resources/provisioning.js +531 -0
- package/dist/esm/resources/sandboxes.d.ts +360 -0
- package/dist/esm/resources/sandboxes.js +718 -0
- package/dist/esm/rpc-types.d.ts +36 -0
- package/dist/esm/rpc-types.js +26 -0
- package/dist/esm/runtime.d.ts +99 -0
- package/dist/esm/runtime.js +466 -0
- package/dist/esm/transport.d.ts +60 -0
- package/dist/esm/transport.js +110 -0
- package/dist/esm/types.d.ts +309 -0
- package/dist/esm/types.js +1 -0
- package/package.json +155 -4
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { requireText, required } from "../errors.js";
|
|
2
|
+
import { OrganizationSandboxes } from "./sandboxes.js";
|
|
3
|
+
/** The authenticated account and its initial organization. Access through `client.user`. */
|
|
4
|
+
export class Users {
|
|
5
|
+
#rpc;
|
|
6
|
+
constructor(rpc) {
|
|
7
|
+
this.#rpc = rpc;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve the current user, organization memberships, and default organization.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
13
|
+
*/
|
|
14
|
+
async get(options) {
|
|
15
|
+
return this.#rpc.getCurrentUser(options);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Initialize the authenticated account and its first organization.
|
|
19
|
+
*
|
|
20
|
+
* @param input - Optional organization display name; when omitted, the server derives a name.
|
|
21
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
22
|
+
*/
|
|
23
|
+
async bootstrap(input = {}, options) {
|
|
24
|
+
return this.#rpc.bootstrapCurrentUser(input, options);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Organizations accessible to the authenticated account. Access through `client.organizations`. */
|
|
28
|
+
export class Organizations {
|
|
29
|
+
#rpc;
|
|
30
|
+
constructor(rpc) {
|
|
31
|
+
this.#rpc = rpc;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Return the current user's organizations as an array.
|
|
35
|
+
*
|
|
36
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
37
|
+
*/
|
|
38
|
+
async list(options) {
|
|
39
|
+
return (await this.#rpc.getCurrentUser(options)).orgs;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Retrieve an organization record.
|
|
43
|
+
*
|
|
44
|
+
* @param id - Organization identifier.
|
|
45
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
46
|
+
*/
|
|
47
|
+
async get(id, options) {
|
|
48
|
+
requireText(id, "organization id");
|
|
49
|
+
return this.#rpc.getOrg({ orgId: id }, options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create an organization with the authenticated caller as its owner.
|
|
53
|
+
*
|
|
54
|
+
* @param input - Display name and optional globally unique slug. The server allocates an omitted slug.
|
|
55
|
+
* @returns The organization record; use `client.org(result.id)` to access its resources.
|
|
56
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
57
|
+
*/
|
|
58
|
+
async create(input, options) {
|
|
59
|
+
requireText(input?.name, "name");
|
|
60
|
+
return this.#rpc.createOrg(input, options);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Memberships of the bound organization. Access through `client.org(orgId).members`. */
|
|
64
|
+
export class Members {
|
|
65
|
+
orgId;
|
|
66
|
+
#rpc;
|
|
67
|
+
constructor(rpc, orgId) {
|
|
68
|
+
this.orgId = orgId;
|
|
69
|
+
this.#rpc = rpc;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Return the organization's members as an array.
|
|
73
|
+
*
|
|
74
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
75
|
+
*/
|
|
76
|
+
async list(options) {
|
|
77
|
+
return (await this.#rpc.listOrgMembers({ orgId: this.orgId }, options))
|
|
78
|
+
.members;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Product access requests for the bound organization. Access through `org.accessRequests`. */
|
|
82
|
+
export class AccessRequests {
|
|
83
|
+
orgId;
|
|
84
|
+
#rpc;
|
|
85
|
+
constructor(rpc, orgId) {
|
|
86
|
+
this.orgId = orgId;
|
|
87
|
+
this.#rpc = rpc;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* List recent product access requests, newest first.
|
|
91
|
+
*
|
|
92
|
+
* @param filter - Optional product and result limit; the server defaults to 25 and caps the limit at 100.
|
|
93
|
+
* @returns An array from one server response; the SDK does not fetch additional pages.
|
|
94
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
95
|
+
*/
|
|
96
|
+
async list(filter = {}, options) {
|
|
97
|
+
return (await this.#rpc.listProductAccessRequests({ ...filter, orgId: this.orgId }, options)).requests;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Submit a product access request for this organization.
|
|
101
|
+
*
|
|
102
|
+
* @param input - Product, use case, and optional contact/company details. Omitted contact email uses the authenticated account.
|
|
103
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
104
|
+
*/
|
|
105
|
+
async create(input, options) {
|
|
106
|
+
requireText(input?.product, "product");
|
|
107
|
+
return this.#rpc.requestProductAccess({ ...input, orgId: this.orgId }, options);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** API keys for the bound organization. Access through `org.apiKeys`. */
|
|
111
|
+
export class ApiKeys {
|
|
112
|
+
orgId;
|
|
113
|
+
#rpc;
|
|
114
|
+
constructor(rpc, orgId) {
|
|
115
|
+
this.orgId = orgId;
|
|
116
|
+
this.#rpc = rpc;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* List API key metadata. Previously issued plaintext secrets are not returned.
|
|
120
|
+
*
|
|
121
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
122
|
+
*/
|
|
123
|
+
async list(options) {
|
|
124
|
+
return (await this.#rpc.listApiKeys({ orgId: this.orgId }, options))
|
|
125
|
+
.apiKeys;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Create an API key and return its metadata with a one-time `secret`.
|
|
129
|
+
*
|
|
130
|
+
* @param input - Optional label, product scopes, and allowed model aliases. Omitted scopes use the server's inference default.
|
|
131
|
+
* @returns The key record plus `secret`; store the secret at creation because it cannot be retrieved later.
|
|
132
|
+
* @example
|
|
133
|
+
* const key = await org.apiKeys.create({ label: "worker", scopes: ["inference"] });
|
|
134
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
135
|
+
*/
|
|
136
|
+
async create(input = {}, options) {
|
|
137
|
+
const response = await this.#rpc.createApiKey({ ...input, orgId: this.orgId }, options);
|
|
138
|
+
return {
|
|
139
|
+
...required(response.apiKey, "apiKey"),
|
|
140
|
+
secret: response.plaintextKey,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Revoke an API key and return its updated metadata.
|
|
145
|
+
*
|
|
146
|
+
* @param id - API key identifier, not its secret.
|
|
147
|
+
* @param input - Optional human-readable revocation reason.
|
|
148
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
149
|
+
*/
|
|
150
|
+
async revoke(id, input = {}, options) {
|
|
151
|
+
requireText(id, "API key id");
|
|
152
|
+
return required((await this.#rpc.revokeApiKey({ orgId: this.orgId, apiKeyId: id, revokedReason: input.reason }, options)).apiKey, "apiKey");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** Inference limits and model policy for the bound organization. Access through `org.quotas`. */
|
|
156
|
+
export class Quotas {
|
|
157
|
+
orgId;
|
|
158
|
+
#rpc;
|
|
159
|
+
constructor(rpc, orgId) {
|
|
160
|
+
this.orgId = orgId;
|
|
161
|
+
this.#rpc = rpc;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Retrieve the organization's effective inference quota policy.
|
|
165
|
+
*
|
|
166
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
167
|
+
*/
|
|
168
|
+
async get(options) {
|
|
169
|
+
return this.#rpc.getQuotaPolicy({ orgId: this.orgId }, options);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Replace the organization's quota policy.
|
|
173
|
+
*
|
|
174
|
+
* Omitted optional limits become unlimited. This is a replacement, so include all limits you intend to retain.
|
|
175
|
+
* @param input - Complete desired policy. Supply `allowedModelAliases` when `allowAllModels` is false; 64-bit budgets use bigint.
|
|
176
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
177
|
+
*/
|
|
178
|
+
async update(input, options) {
|
|
179
|
+
return this.#rpc.updateQuotaPolicy({ ...input, orgId: this.orgId }, options);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** Inference usage for the bound organization. Access through `org.usage`. */
|
|
183
|
+
export class Usage {
|
|
184
|
+
orgId;
|
|
185
|
+
#rpc;
|
|
186
|
+
constructor(rpc, orgId) {
|
|
187
|
+
this.orgId = orgId;
|
|
188
|
+
this.#rpc = rpc;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* List usage events as an array.
|
|
192
|
+
*
|
|
193
|
+
* @param filter - Optional result limit; omitted values use the server default.
|
|
194
|
+
* @returns One server response without automatic pagination; 64-bit counters and IDs remain bigint.
|
|
195
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
196
|
+
*/
|
|
197
|
+
async list(filter = {}, options) {
|
|
198
|
+
return (await this.#rpc.listUsageEvents({ ...filter, orgId: this.orgId }, options)).usageEvents;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Retrieve the organization's aggregate usage counters.
|
|
202
|
+
*
|
|
203
|
+
* @returns A usage summary with lossless bigint counters.
|
|
204
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
205
|
+
*/
|
|
206
|
+
async summary(options) {
|
|
207
|
+
return this.#rpc.getUsageSummary({ orgId: this.orgId }, options);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/** Observed and desired state of managed compute. Access through `org.compute.resources`. */
|
|
211
|
+
export class ComputeResources {
|
|
212
|
+
orgId;
|
|
213
|
+
#rpc;
|
|
214
|
+
constructor(rpc, orgId) {
|
|
215
|
+
this.orgId = orgId;
|
|
216
|
+
this.#rpc = rpc;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* List provisioned compute resources as an array.
|
|
220
|
+
*
|
|
221
|
+
* @param filter - Optional resource type filter.
|
|
222
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
223
|
+
*/
|
|
224
|
+
async list(filter = {}, options) {
|
|
225
|
+
return (await this.#rpc.listProvisionedResources({ ...filter, orgId: this.orgId }, options)).resources;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Retrieve the current record for a provisioned compute resource.
|
|
229
|
+
*
|
|
230
|
+
* @param id - Resource identifier returned by a compute creation method.
|
|
231
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
232
|
+
*/
|
|
233
|
+
async get(id, options) {
|
|
234
|
+
requireText(id, "resource id");
|
|
235
|
+
return this.#rpc.getProvisionedResource({ orgId: this.orgId, resourceId: id }, options);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/** Managed inference service creation. Access through `org.compute.inferenceServices`. */
|
|
239
|
+
export class InferenceServices {
|
|
240
|
+
orgId;
|
|
241
|
+
#rpc;
|
|
242
|
+
constructor(rpc, orgId) {
|
|
243
|
+
this.orgId = orgId;
|
|
244
|
+
this.#rpc = rpc;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Request a managed inference service and return its resource record.
|
|
248
|
+
*
|
|
249
|
+
* @param input - DNS-label name, model alias, and optional capacity/specification fields.
|
|
250
|
+
* @returns Desired and observed resource state. Creation does not poll for readiness; inspect `org.compute.resources.get(id)`.
|
|
251
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
252
|
+
*/
|
|
253
|
+
async create(input, options) {
|
|
254
|
+
return this.#rpc.createInferenceService({ ...input, orgId: this.orgId }, options);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/** Managed agent host creation. Access through `org.compute.agentHosts`. */
|
|
258
|
+
export class AgentHosts {
|
|
259
|
+
orgId;
|
|
260
|
+
#rpc;
|
|
261
|
+
constructor(rpc, orgId) {
|
|
262
|
+
this.orgId = orgId;
|
|
263
|
+
this.#rpc = rpc;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Request an agent host and return its resource record.
|
|
267
|
+
*
|
|
268
|
+
* @param input - DNS-label name, container image, and optional service/capacity settings. Extension `spec` must not contain secrets.
|
|
269
|
+
* @returns Desired and observed resource state, without readiness polling.
|
|
270
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
271
|
+
*/
|
|
272
|
+
async create(input, options) {
|
|
273
|
+
return this.#rpc.createAgentHost({ ...input, orgId: this.orgId }, options);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/** Finite-duration container jobs. Access through `org.compute.jobs`. */
|
|
277
|
+
export class Jobs {
|
|
278
|
+
orgId;
|
|
279
|
+
#rpc;
|
|
280
|
+
constructor(rpc, orgId) {
|
|
281
|
+
this.orgId = orgId;
|
|
282
|
+
this.#rpc = rpc;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Request a container job and return its resource record.
|
|
286
|
+
*
|
|
287
|
+
* @param input - DNS-label name, container image, optional argv `command`, and server execution limit in `timeoutSeconds`.
|
|
288
|
+
* @returns Desired and observed resource state, without waiting for the job to finish. Commands are passed without shell expansion.
|
|
289
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
290
|
+
*/
|
|
291
|
+
async create(input, options) {
|
|
292
|
+
return this.#rpc.createJob({ ...input, orgId: this.orgId }, options);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/** Managed compute for the bound organization. Access through `org.compute`. */
|
|
296
|
+
export class Compute {
|
|
297
|
+
/** List and inspect all provisioned compute resource types. */
|
|
298
|
+
resources;
|
|
299
|
+
/** Create managed inference services. */
|
|
300
|
+
inferenceServices;
|
|
301
|
+
/** Create managed agent hosts. */
|
|
302
|
+
agentHosts;
|
|
303
|
+
/** Create container jobs. */
|
|
304
|
+
jobs;
|
|
305
|
+
constructor(rpc, orgId) {
|
|
306
|
+
this.resources = new ComputeResources(rpc, orgId);
|
|
307
|
+
this.inferenceServices = new InferenceServices(rpc, orgId);
|
|
308
|
+
this.agentHosts = new AgentHosts(rpc, orgId);
|
|
309
|
+
this.jobs = new Jobs(rpc, orgId);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/** Storage buckets for the bound organization. Access through `org.storage.buckets`. */
|
|
313
|
+
export class StorageBuckets {
|
|
314
|
+
orgId;
|
|
315
|
+
#rpc;
|
|
316
|
+
constructor(rpc, orgId) {
|
|
317
|
+
this.orgId = orgId;
|
|
318
|
+
this.#rpc = rpc;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* List the organization's bucket records as an array.
|
|
322
|
+
*
|
|
323
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
324
|
+
*/
|
|
325
|
+
async list(options) {
|
|
326
|
+
return (await this.#rpc.listStorageBuckets({ orgId: this.orgId }, options))
|
|
327
|
+
.buckets;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Create a storage bucket and return its record.
|
|
331
|
+
*
|
|
332
|
+
* @param input - Requested bucket name.
|
|
333
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
334
|
+
*/
|
|
335
|
+
async create(input, options) {
|
|
336
|
+
requireText(input?.name, "name");
|
|
337
|
+
return this.#rpc.createStorageBucket({ ...input, orgId: this.orgId }, options);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Request deletion of a storage bucket.
|
|
341
|
+
*
|
|
342
|
+
* @param id - Bucket identifier, not its display name.
|
|
343
|
+
* @returns Resolves without a value after acknowledgement.
|
|
344
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
345
|
+
*/
|
|
346
|
+
async delete(id, options) {
|
|
347
|
+
requireText(id, "bucket id");
|
|
348
|
+
await this.#rpc.deleteStorageBucket({ orgId: this.orgId, bucketId: id }, options);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/** Credentials scoped to one organization and bucket. Obtain through `org.storage.credentials(bucketId)`. */
|
|
352
|
+
export class StorageCredentials {
|
|
353
|
+
orgId;
|
|
354
|
+
bucketId;
|
|
355
|
+
#rpc;
|
|
356
|
+
constructor(rpc, orgId, bucketId) {
|
|
357
|
+
this.orgId = orgId;
|
|
358
|
+
this.bucketId = bucketId;
|
|
359
|
+
this.#rpc = rpc;
|
|
360
|
+
requireText(bucketId, "bucket id");
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* List credential metadata for this bucket; plaintext secrets are not returned.
|
|
364
|
+
*
|
|
365
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
366
|
+
*/
|
|
367
|
+
async list(options) {
|
|
368
|
+
return (await this.#rpc.listStorageCredentials({ orgId: this.orgId, bucketId: this.bucketId }, options)).credentials;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Create a bucket credential with one-time access credentials.
|
|
372
|
+
*
|
|
373
|
+
* @param input - Optional display label for the credential.
|
|
374
|
+
* @returns Credential metadata plus `accessKeyId`, `secretAccessKey`, `endpoint`, and `region`. Store the secret at creation.
|
|
375
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
376
|
+
*/
|
|
377
|
+
async create(input = {}, options) {
|
|
378
|
+
const response = await this.#rpc.createStorageCredential({ ...input, orgId: this.orgId, bucketId: this.bucketId }, options);
|
|
379
|
+
return {
|
|
380
|
+
...required(response.credential, "credential"),
|
|
381
|
+
accessKeyId: response.accessKeyId,
|
|
382
|
+
secretAccessKey: response.secretAccessKey,
|
|
383
|
+
endpoint: response.endpoint,
|
|
384
|
+
region: response.region,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Revoke a bucket credential and return its updated metadata.
|
|
389
|
+
*
|
|
390
|
+
* @param id - Credential identifier from its record, not the access key or secret.
|
|
391
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
392
|
+
*/
|
|
393
|
+
async revoke(id, options) {
|
|
394
|
+
requireText(id, "credential id");
|
|
395
|
+
return this.#rpc.revokeStorageCredential({ orgId: this.orgId, bucketId: this.bucketId, credentialId: id }, options);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/** Storage resources for the bound organization. Access through `org.storage`. */
|
|
399
|
+
export class Storage {
|
|
400
|
+
orgId;
|
|
401
|
+
#rpc;
|
|
402
|
+
/** Create, list, and delete storage buckets. */
|
|
403
|
+
buckets;
|
|
404
|
+
constructor(rpc, orgId) {
|
|
405
|
+
this.orgId = orgId;
|
|
406
|
+
this.#rpc = rpc;
|
|
407
|
+
this.buckets = new StorageBuckets(rpc, orgId);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Bind credential operations to a bucket without making a network request.
|
|
411
|
+
*
|
|
412
|
+
* @param bucketId - Bucket identifier returned by `buckets.create()` or `buckets.list()`.
|
|
413
|
+
* @example
|
|
414
|
+
* const credentials = org.storage.credentials(bucket.id);
|
|
415
|
+
* const key = await credentials.create({ label: "worker" });
|
|
416
|
+
*/
|
|
417
|
+
credentials(bucketId) {
|
|
418
|
+
return new StorageCredentials(this.#rpc, this.orgId, bucketId);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
/** Hosted Git repositories for the bound organization. Access through `org.repositories`. */
|
|
422
|
+
export class GitRepositories {
|
|
423
|
+
orgId;
|
|
424
|
+
#rpc;
|
|
425
|
+
constructor(rpc, orgId) {
|
|
426
|
+
this.orgId = orgId;
|
|
427
|
+
this.#rpc = rpc;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* List hosted Git repository records as an array.
|
|
431
|
+
*
|
|
432
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
433
|
+
*/
|
|
434
|
+
async list(options) {
|
|
435
|
+
return (await this.#rpc.listGitRepositories({ orgId: this.orgId }, options))
|
|
436
|
+
.repositories;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Create a hosted Git repository and return its record.
|
|
440
|
+
*
|
|
441
|
+
* @param input - Repository name and optional description, visibility, and initialization settings.
|
|
442
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
443
|
+
*/
|
|
444
|
+
async create(input, options) {
|
|
445
|
+
requireText(input?.name, "name");
|
|
446
|
+
return this.#rpc.createGitRepository({ ...input, orgId: this.orgId }, options);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Request deletion of a hosted Git repository.
|
|
450
|
+
*
|
|
451
|
+
* @param id - Repository identifier.
|
|
452
|
+
* @returns Resolves without a value after acknowledgement.
|
|
453
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
454
|
+
*/
|
|
455
|
+
async delete(id, options) {
|
|
456
|
+
requireText(id, "repository id");
|
|
457
|
+
await this.#rpc.deleteGitRepository({ orgId: this.orgId, repositoryId: id }, options);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
/** Hosted Git access for the authenticated account. Access through `client.git`. */
|
|
461
|
+
export class Git {
|
|
462
|
+
#rpc;
|
|
463
|
+
constructor(rpc) {
|
|
464
|
+
this.#rpc = rpc;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Ensure the account has a hosted Git identity and return its current access state.
|
|
468
|
+
*
|
|
469
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
470
|
+
*/
|
|
471
|
+
async ensureAccess(options) {
|
|
472
|
+
return this.#rpc.ensureHostedGitAccess(options);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
/** Organization context created by `client.org(id)`. Construction makes no network request; nested calls retain this organization ID. */
|
|
476
|
+
export class OrganizationScope {
|
|
477
|
+
id;
|
|
478
|
+
#rpc;
|
|
479
|
+
/** Organization memberships. */
|
|
480
|
+
members;
|
|
481
|
+
/** Product entitlement requests. */
|
|
482
|
+
accessRequests;
|
|
483
|
+
/** API key creation, metadata, and revocation. */
|
|
484
|
+
apiKeys;
|
|
485
|
+
/** Inference quota and model policy. */
|
|
486
|
+
quotas;
|
|
487
|
+
/** Usage events and aggregate counters. */
|
|
488
|
+
usage;
|
|
489
|
+
/** Managed inference services, agent hosts, and jobs. */
|
|
490
|
+
compute;
|
|
491
|
+
/** Storage buckets and bucket-scoped credentials. */
|
|
492
|
+
storage;
|
|
493
|
+
/** Hosted Git repositories. */
|
|
494
|
+
repositories;
|
|
495
|
+
/** Sandbox lifecycle, reusable templates, and code execution. */
|
|
496
|
+
sandboxes;
|
|
497
|
+
constructor(rpc, sandboxRpc,
|
|
498
|
+
/** Organization identifier automatically included in this scope's requests. */
|
|
499
|
+
id) {
|
|
500
|
+
this.id = id;
|
|
501
|
+
this.#rpc = rpc;
|
|
502
|
+
requireText(id, "organization id");
|
|
503
|
+
this.members = new Members(rpc, id);
|
|
504
|
+
this.accessRequests = new AccessRequests(rpc, id);
|
|
505
|
+
this.apiKeys = new ApiKeys(rpc, id);
|
|
506
|
+
this.quotas = new Quotas(rpc, id);
|
|
507
|
+
this.usage = new Usage(rpc, id);
|
|
508
|
+
this.compute = new Compute(rpc, id);
|
|
509
|
+
this.storage = new Storage(rpc, id);
|
|
510
|
+
this.repositories = new GitRepositories(rpc, id);
|
|
511
|
+
this.sandboxes = new OrganizationSandboxes(sandboxRpc, id);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Fetch this organization's record.
|
|
515
|
+
*
|
|
516
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
517
|
+
*/
|
|
518
|
+
async get(options) {
|
|
519
|
+
return this.#rpc.getOrg({ orgId: this.id }, options);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Update this organization's display name and return its record.
|
|
523
|
+
*
|
|
524
|
+
* @param input - New non-empty display name; the immutable slug is unchanged.
|
|
525
|
+
* @param options - Per-call timeout in milliseconds, cancellation signal, and metadata.
|
|
526
|
+
*/
|
|
527
|
+
async update(input, options) {
|
|
528
|
+
requireText(input?.name, "name");
|
|
529
|
+
return this.#rpc.updateOrg({ orgId: this.id, name: input.name }, options);
|
|
530
|
+
}
|
|
531
|
+
}
|