@toshicloud/sdk 0.5.0 → 0.5.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.
Files changed (71) hide show
  1. package/README.md +82 -40
  2. package/dist/client.d.ts +33 -2
  3. package/dist/client.js +28 -3
  4. package/dist/errors.d.ts +74 -22
  5. package/dist/errors.js +99 -27
  6. package/dist/gen/toshi/permission_pb.d.ts +207 -2
  7. package/dist/gen/toshi/permission_pb.js +54 -2
  8. package/dist/gen/toshi/workspace/v1/account_pb.d.ts +590 -0
  9. package/dist/gen/toshi/workspace/v1/account_pb.js +75 -0
  10. package/dist/gen/toshi/workspace/v1/artifacts_pb.d.ts +14 -8
  11. package/dist/gen/toshi/workspace/v1/artifacts_pb.js +9 -7
  12. package/dist/gen/toshi/workspace/v1/audit_events_pb.d.ts +191 -6
  13. package/dist/gen/toshi/workspace/v1/audit_events_pb.js +11 -1
  14. package/dist/gen/toshi/workspace/v1/channels_pb.d.ts +1194 -21
  15. package/dist/gen/toshi/workspace/v1/channels_pb.js +185 -39
  16. package/dist/gen/toshi/workspace/v1/connections_pb.d.ts +1481 -0
  17. package/dist/gen/toshi/workspace/v1/connections_pb.js +208 -0
  18. package/dist/gen/toshi/workspace/v1/discovery_pb.d.ts +291 -43
  19. package/dist/gen/toshi/workspace/v1/discovery_pb.js +79 -30
  20. package/dist/gen/toshi/workspace/v1/display_pb.d.ts +198 -15
  21. package/dist/gen/toshi/workspace/v1/display_pb.js +52 -2
  22. package/dist/gen/toshi/workspace/v1/domains_pb.d.ts +864 -0
  23. package/dist/gen/toshi/workspace/v1/domains_pb.js +152 -0
  24. package/dist/gen/toshi/workspace/v1/fillers_pb.d.ts +12 -4
  25. package/dist/gen/toshi/workspace/v1/fillers_pb.js +1 -1
  26. package/dist/gen/toshi/workspace/v1/grants_pb.d.ts +1297 -0
  27. package/dist/gen/toshi/workspace/v1/grants_pb.js +271 -0
  28. package/dist/gen/toshi/workspace/v1/hostjobs_pb.d.ts +315 -15
  29. package/dist/gen/toshi/workspace/v1/hostjobs_pb.js +10 -5
  30. package/dist/gen/toshi/workspace/v1/hosts_pb.d.ts +196 -7
  31. package/dist/gen/toshi/workspace/v1/hosts_pb.js +12 -7
  32. package/dist/gen/toshi/workspace/v1/images_pb.d.ts +1463 -0
  33. package/dist/gen/toshi/workspace/v1/images_pb.js +263 -0
  34. package/dist/gen/toshi/workspace/v1/products_pb.d.ts +99 -296
  35. package/dist/gen/toshi/workspace/v1/products_pb.js +7 -53
  36. package/dist/gen/toshi/workspace/v1/projects_pb.d.ts +1474 -99
  37. package/dist/gen/toshi/workspace/v1/projects_pb.js +150 -33
  38. package/dist/gen/toshi/workspace/v1/recordings_pb.d.ts +181 -14
  39. package/dist/gen/toshi/workspace/v1/recordings_pb.js +54 -14
  40. package/dist/gen/toshi/workspace/v1/roles_pb.d.ts +1994 -0
  41. package/dist/gen/toshi/workspace/v1/roles_pb.js +355 -0
  42. package/dist/gen/toshi/workspace/v1/secrets_pb.d.ts +314 -8
  43. package/dist/gen/toshi/workspace/v1/secrets_pb.js +42 -18
  44. package/dist/gen/toshi/workspace/v1/storage_providers_pb.d.ts +14 -0
  45. package/dist/gen/toshi/workspace/v1/storage_providers_pb.js +1 -1
  46. package/dist/gen/toshi/workspace/v1/tokens_pb.d.ts +434 -5
  47. package/dist/gen/toshi/workspace/v1/tokens_pb.js +65 -8
  48. package/dist/gen/toshi/workspace/v1/triggers_pb.d.ts +1099 -0
  49. package/dist/gen/toshi/workspace/v1/triggers_pb.js +185 -0
  50. package/dist/gen/toshi/workspace/v1/volumes_pb.d.ts +1052 -33
  51. package/dist/gen/toshi/workspace/v1/volumes_pb.js +169 -11
  52. package/dist/gen/toshi/workspace/v1/webhook_pb.d.ts +66 -8
  53. package/dist/gen/toshi/workspace/v1/webhook_pb.js +4 -4
  54. package/dist/gen/toshi/workspace/v1/workloads_pb.d.ts +2043 -54
  55. package/dist/gen/toshi/workspace/v1/workloads_pb.js +204 -54
  56. package/dist/gen/toshi/workspace/v1/workspace_pb.d.ts +6290 -937
  57. package/dist/gen/toshi/workspace/v1/workspace_pb.js +801 -88
  58. package/dist/gen/toshi/workspace/v1/workspace_service_pb.d.ts +2176 -630
  59. package/dist/gen/toshi/workspace/v1/workspace_service_pb.js +191 -74
  60. package/dist/index.d.ts +8 -1
  61. package/dist/index.js +8 -1
  62. package/dist/interceptors.d.ts +6 -2
  63. package/dist/interceptors.js +13 -8
  64. package/dist/retry.d.ts +18 -0
  65. package/dist/retry.js +225 -23
  66. package/dist/test/procedures.js +100 -5
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/wait.d.ts +4 -0
  70. package/dist/wait.js +24 -1
  71. package/package.json +3 -2
package/dist/errors.js CHANGED
@@ -79,29 +79,58 @@ function describe(cause) {
79
79
  }
80
80
  /** The reasons a call is refused for a product. */
81
81
  export const ProductReason = {
82
- /** The deployment's build does not include the product; the code is Unimplemented. */
83
- NotInstalled: "PRODUCT_NOT_INSTALLED",
84
- /** The deployment turned the product off; the code is FailedPrecondition. */
85
- Disabled: "PRODUCT_DISABLED",
86
- /** The workspace's entitlements leave the product out; the code is PermissionDenied. */
87
- NotEntitled: "PRODUCT_NOT_ENTITLED",
88
82
  /**
89
- * The workspace's settings turn the product off, or an outside product's
90
- * installation is turned off; the code is FailedPrecondition.
83
+ * The product is off for the workspace; the code is FailedPrecondition, and
84
+ * `cause` says which input turned it off.
91
85
  */
92
- TurnedOff: "PRODUCT_TURNED_OFF",
93
- /**
94
- * Turning an outside product on installs it, and the call did not accept the
95
- * access it asks for; the code is FailedPrecondition.
96
- */
97
- AccessNotAccepted: "ACCESS_NOT_ACCEPTED",
86
+ Unavailable: "PRODUCT_UNAVAILABLE",
87
+ };
88
+ /** The inputs that turn a product off. */
89
+ export const ProductCause = {
90
+ /** The deployment's build does not include the product. */
91
+ Build: "build",
92
+ /** The deployment's config turns the product off. */
93
+ Operator: "operator",
94
+ /** The workspace's plan leaves the product out. */
95
+ Plan: "plan",
96
+ /** The workspace's settings turn the product off. */
97
+ Workspace: "workspace",
98
98
  };
99
99
  const productReasons = new Set(Object.values(ProductReason));
100
- // The ErrorInfo domain of a product's refusal.
101
- const productErrorDomain = "toshi.run";
100
+ /** The reasons the API names on a refusal that is not a product's. */
101
+ export const RefusalReason = {
102
+ /** The Windows VM takes no display input; the code is FailedPrecondition. */
103
+ DisplayInputNotEnabled: "DISPLAY_INPUT_NOT_ENABLED",
104
+ /** The image already has a build running; the code is FailedPrecondition. */
105
+ ImageBuildInProgress: "IMAGE_BUILD_IN_PROGRESS",
106
+ /** The registry of the revision's image could not say whether it serves the digest; the code is FailedPrecondition. */
107
+ ImageCheckFailed: "IMAGE_CHECK_FAILED",
108
+ /** A workload or a service revision still uses the image; the code is FailedPrecondition. */
109
+ ImageInUse: "IMAGE_IN_USE",
110
+ /** Another live image of the workspace has the name; the code is AlreadyExists. */
111
+ ImageNameTaken: "IMAGE_NAME_TAKEN",
112
+ /** A workspace image named by a job, a sandbox or a service revision has no ready version; the code is FailedPrecondition. */
113
+ ImageNotReady: "IMAGE_NOT_READY",
114
+ /** The revision's registry answered that it does not serve the image digest; the code is FailedPrecondition. */
115
+ ImageNotServed: "IMAGE_NOT_SERVED",
116
+ /** The call would remove the caller's last identity; the code is FailedPrecondition. */
117
+ LastIdentity: "LAST_IDENTITY",
118
+ /** The call would remove the workspace's last member; the code is FailedPrecondition. */
119
+ LastMember: "LAST_MEMBER",
120
+ /** The call would leave the workspace without an owner; the code is FailedPrecondition. */
121
+ LastOwner: "LAST_OWNER",
122
+ /** A role change names a permission the caller does not hold where the role applies; the code is PermissionDenied. */
123
+ PermissionMissing: "PERMISSION_MISSING",
124
+ /** The workspace's plan does not include images; the code is FailedPrecondition. */
125
+ PlanExcludesImages: "PLAN_EXCLUDES_IMAGES",
126
+ /** A Windows job Toshi licenses opens no display session; the code is FailedPrecondition. */
127
+ ToshiLicensedWindows: "TOSHI_LICENSED_WINDOWS",
128
+ };
129
+ const refusalReasons = new Set(Object.values(RefusalReason));
130
+ // The ErrorInfo domain of the API's refusals.
131
+ const errorInfoDomain = "toshi.run";
102
132
  /**
103
- * The API's refusal of a call for a product: one that is off for the
104
- * workspace, or an outside product whose access the call did not accept.
133
+ * The API's refusal of a call for a product that is off for the workspace.
105
134
  * Every call the client makes throws it in place of the ConnectError, wait,
106
135
  * watch and execute included. It is a ConnectError, so `instanceof
107
136
  * ConnectError` and `code` read as before; test for it with
@@ -111,12 +140,10 @@ export class ProductError extends ConnectError {
111
140
  /** The product's ID, such as `runners`. */
112
141
  product;
113
142
  reason;
114
- /** The setting that turns the product on, such as `runners.enabled`; empty for ACCESS_NOT_ACCEPTED. */
115
- feature;
116
- /** How far a product the deployment disables has wound down: `no_new_work`, `draining` or `stopped`; empty otherwise. */
143
+ /** The input that turned the product off, the refusal's `cause` metadata: `build`, `operator`, `plan` or `workspace`. */
144
+ productCause;
145
+ /** How far a product the deployment turns off has wound down: `no_new_work`, `draining` or `stopped`; empty otherwise. */
117
146
  state;
118
- /** The access an outside product asks for, for ACCESS_NOT_ACCEPTED: accept exactly this list to install it. */
119
- access;
120
147
  constructor(err, reason, metadata) {
121
148
  super(err.rawMessage, err.code, err.metadata, undefined, err);
122
149
  // ConnectError's instanceof accepts a subclass only by this name.
@@ -124,10 +151,8 @@ export class ProductError extends ConnectError {
124
151
  this.details = err.details;
125
152
  this.product = metadata.get("product") ?? "";
126
153
  this.reason = reason;
127
- this.feature = metadata.get("feature") ?? "";
154
+ this.productCause = (metadata.get("cause") ?? "");
128
155
  this.state = metadata.get("state") ?? "";
129
- const access = metadata.get("access") ?? "";
130
- this.access = access === "" ? [] : access.split(",");
131
156
  }
132
157
  // ConnectError's own check would accept any ConnectError.
133
158
  static [Symbol.hasInstance](v) {
@@ -138,6 +163,32 @@ export class ProductError extends ConnectError {
138
163
  export function isProductError(err) {
139
164
  return err instanceof ProductError;
140
165
  }
166
+ /**
167
+ * The API's refusal that names a reason: an image still in use, a plan
168
+ * without images, a last identity, a rollback whose revision's image is gone,
169
+ * and the rest of {@link RefusalReason}. Every call the client makes throws
170
+ * it in place of the ConnectError. It is a ConnectError, so `instanceof
171
+ * ConnectError` and `code` read as before; test for it with
172
+ * {@link isRefusalError}.
173
+ */
174
+ export class RefusalError extends ConnectError {
175
+ reason;
176
+ constructor(err, reason) {
177
+ super(err.rawMessage, err.code, err.metadata, undefined, err);
178
+ // ConnectError's instanceof accepts a subclass only by this name.
179
+ this.name = "ConnectError";
180
+ this.details = err.details;
181
+ this.reason = reason;
182
+ }
183
+ // ConnectError's own check would accept any ConnectError.
184
+ static [Symbol.hasInstance](v) {
185
+ return Function.prototype[Symbol.hasInstance].call(RefusalError, v);
186
+ }
187
+ }
188
+ /** Reports whether err is a refusal that names a reason this module knows. */
189
+ export function isRefusalError(err) {
190
+ return err instanceof RefusalError;
191
+ }
141
192
  /** err as a ProductError when it is a product's refusal, and err unchanged otherwise. */
142
193
  export function asProductError(err) {
143
194
  if (!(err instanceof ConnectError) || err instanceof ProductError) {
@@ -148,13 +199,34 @@ export function asProductError(err) {
148
199
  continue;
149
200
  }
150
201
  const info = decodeErrorInfo(detail.value);
151
- if (info === undefined || info.domain !== productErrorDomain || !productReasons.has(info.reason)) {
202
+ if (info === undefined || info.domain !== errorInfoDomain || !productReasons.has(info.reason)) {
152
203
  continue;
153
204
  }
154
205
  return new ProductError(err, info.reason, info.metadata);
155
206
  }
156
207
  return err;
157
208
  }
209
+ /** err as a RefusalError when it is a refusal that names a reason this module knows, and err unchanged otherwise. */
210
+ export function asRefusalError(err) {
211
+ if (!(err instanceof ConnectError) || err instanceof RefusalError) {
212
+ return err;
213
+ }
214
+ for (const detail of err.details) {
215
+ if (!("type" in detail) || detail.type !== "google.rpc.ErrorInfo") {
216
+ continue;
217
+ }
218
+ const info = decodeErrorInfo(detail.value);
219
+ if (info === undefined || info.domain !== errorInfoDomain || !refusalReasons.has(info.reason)) {
220
+ continue;
221
+ }
222
+ return new RefusalError(err, info.reason);
223
+ }
224
+ return err;
225
+ }
226
+ /** err as one of this module's typed errors when the API's ErrorInfo detail names a reason it knows, and err unchanged otherwise. */
227
+ export function asTypedError(err) {
228
+ return asRefusalError(asProductError(err));
229
+ }
158
230
  /**
159
231
  * Reads a google.rpc.ErrorInfo message: reason (1), domain (2) and metadata
160
232
  * (3), a map of strings. It reads the wire format itself, so the SDK needs no
@@ -1,9 +1,172 @@
1
- import type { GenExtension, GenFile } from "@bufbuild/protobuf/codegenv2";
2
- import type { MethodOptions } from "@bufbuild/protobuf/wkt";
1
+ import type { GenExtension, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
2
+ import type { FieldOptions, MethodOptions } from "@bufbuild/protobuf/wkt";
3
+ import type { Message } from "@bufbuild/protobuf";
3
4
  /**
4
5
  * Describes the file toshi/permission.proto.
5
6
  */
6
7
  export declare const file_toshi_permission: GenFile;
8
+ /**
9
+ * Audit is the audit event a call records.
10
+ *
11
+ * @generated from message toshi.Audit
12
+ */
13
+ export type Audit = Message<"toshi.Audit"> & {
14
+ /**
15
+ * action is "<noun>.<verb>" with the verb in the past tense. Unset, it is
16
+ * the method's name: CreateSandbox records "sandbox.created". The build
17
+ * fails a method whose verb it cannot put in the past tense, or whose name
18
+ * gives the action this field names. "none" records nothing, for a call
19
+ * no Workspace API caller makes, such as a workload's upload.
20
+ *
21
+ * @generated from field: string action = 1;
22
+ */
23
+ action: string;
24
+ /**
25
+ * target is what the call acts on, as "<kind>:<source>", or "none". Unset,
26
+ * the kind is the action's noun and the source the response's id for a
27
+ * call that creates (Create, Reserve, Open) and the request's id
28
+ * otherwise: "id" or "<kind>_id", or for a create "<kind>.id" of the
29
+ * response. A source is a request field path, such as "job_id" or
30
+ * "start.sandbox_id", a response field path after "response.", such as
31
+ * "response.endpoint.id", "workspace" for the call's workspace, or
32
+ * "project" for the project the call resolved.
33
+ *
34
+ * @generated from field: string target = 2;
35
+ */
36
+ target: string;
37
+ };
38
+ /**
39
+ * Audit is the audit event a call records.
40
+ *
41
+ * @generated from message toshi.Audit
42
+ */
43
+ export type AuditJson = {
44
+ /**
45
+ * action is "<noun>.<verb>" with the verb in the past tense. Unset, it is
46
+ * the method's name: CreateSandbox records "sandbox.created". The build
47
+ * fails a method whose verb it cannot put in the past tense, or whose name
48
+ * gives the action this field names. "none" records nothing, for a call
49
+ * no Workspace API caller makes, such as a workload's upload.
50
+ *
51
+ * @generated from field: string action = 1;
52
+ */
53
+ action?: string;
54
+ /**
55
+ * target is what the call acts on, as "<kind>:<source>", or "none". Unset,
56
+ * the kind is the action's noun and the source the response's id for a
57
+ * call that creates (Create, Reserve, Open) and the request's id
58
+ * otherwise: "id" or "<kind>_id", or for a create "<kind>.id" of the
59
+ * response. A source is a request field path, such as "job_id" or
60
+ * "start.sandbox_id", a response field path after "response.", such as
61
+ * "response.endpoint.id", "workspace" for the call's workspace, or
62
+ * "project" for the project the call resolved.
63
+ *
64
+ * @generated from field: string target = 2;
65
+ */
66
+ target?: string;
67
+ };
68
+ /**
69
+ * Describes the message toshi.Audit.
70
+ * Use `create(AuditSchema)` to create a new message.
71
+ */
72
+ export declare const AuditSchema: GenMessage<Audit, {
73
+ jsonType: AuditJson;
74
+ }>;
75
+ /**
76
+ * MCP is how a call appears as a tool of the MCP server: each hint that is
77
+ * set replaces the one the generator's rules give, and exclude leaves the
78
+ * call out of the tool list.
79
+ *
80
+ * @generated from message toshi.MCP
81
+ */
82
+ export type MCP = Message<"toshi.MCP"> & {
83
+ /**
84
+ * read_only is the tool's readOnlyHint: the call changes nothing.
85
+ *
86
+ * @generated from field: optional bool read_only = 1;
87
+ */
88
+ readOnly?: boolean | undefined;
89
+ /**
90
+ * destructive is the tool's destructiveHint: the call may end or remove
91
+ * something it cannot bring back.
92
+ *
93
+ * @generated from field: optional bool destructive = 2;
94
+ */
95
+ destructive?: boolean | undefined;
96
+ /**
97
+ * idempotent is the tool's idempotentHint: a second call with the same
98
+ * input changes nothing more.
99
+ *
100
+ * @generated from field: optional bool idempotent = 3;
101
+ */
102
+ idempotent?: boolean | undefined;
103
+ /**
104
+ * open_world is the tool's openWorldHint: the call reaches past the
105
+ * workspace, such as a workload that reaches what its network policy
106
+ * allows.
107
+ *
108
+ * @generated from field: optional bool open_world = 4;
109
+ */
110
+ openWorld?: boolean | undefined;
111
+ /**
112
+ * exclude leaves the call out, for a call that makes no sense as a tool,
113
+ * such as one only a workload's own token may make.
114
+ *
115
+ * @generated from field: bool exclude = 5;
116
+ */
117
+ exclude: boolean;
118
+ };
119
+ /**
120
+ * MCP is how a call appears as a tool of the MCP server: each hint that is
121
+ * set replaces the one the generator's rules give, and exclude leaves the
122
+ * call out of the tool list.
123
+ *
124
+ * @generated from message toshi.MCP
125
+ */
126
+ export type MCPJson = {
127
+ /**
128
+ * read_only is the tool's readOnlyHint: the call changes nothing.
129
+ *
130
+ * @generated from field: optional bool read_only = 1;
131
+ */
132
+ readOnly?: boolean;
133
+ /**
134
+ * destructive is the tool's destructiveHint: the call may end or remove
135
+ * something it cannot bring back.
136
+ *
137
+ * @generated from field: optional bool destructive = 2;
138
+ */
139
+ destructive?: boolean;
140
+ /**
141
+ * idempotent is the tool's idempotentHint: a second call with the same
142
+ * input changes nothing more.
143
+ *
144
+ * @generated from field: optional bool idempotent = 3;
145
+ */
146
+ idempotent?: boolean;
147
+ /**
148
+ * open_world is the tool's openWorldHint: the call reaches past the
149
+ * workspace, such as a workload that reaches what its network policy
150
+ * allows.
151
+ *
152
+ * @generated from field: optional bool open_world = 4;
153
+ */
154
+ openWorld?: boolean;
155
+ /**
156
+ * exclude leaves the call out, for a call that makes no sense as a tool,
157
+ * such as one only a workload's own token may make.
158
+ *
159
+ * @generated from field: bool exclude = 5;
160
+ */
161
+ exclude?: boolean;
162
+ };
163
+ /**
164
+ * Describes the message toshi.MCP.
165
+ * Use `create(MCPSchema)` to create a new message.
166
+ */
167
+ export declare const MCPSchema: GenMessage<MCP, {
168
+ jsonType: MCPJson;
169
+ }>;
7
170
  /**
8
171
  * permission names what a caller needs to make the call: an area and a
9
172
  * level. "<area>.read" sees what the area holds and "<area>.write" changes
@@ -37,3 +200,45 @@ export declare const permission: GenExtension<MethodOptions, string>;
37
200
  * @generated from extension: string scope = 51001;
38
201
  */
39
202
  export declare const scope: GenExtension<MethodOptions, string>;
203
+ /**
204
+ * audit names the audit event a call records when its action or target
205
+ * is not the one its name gives. Every call that changes something
206
+ * records one event: on the Workspace API a call whose permission's level
207
+ * is not "read", on the operator API a call whose verb is not a read
208
+ * (Get, List, Watch, Wait, Summarise, Suggest, Export, Discover). A read
209
+ * whose option names an action records one too.
210
+ *
211
+ * @generated from extension: toshi.Audit audit = 51002;
212
+ */
213
+ export declare const audit: GenExtension<MethodOptions, Audit>;
214
+ /**
215
+ * by_field marks an update call that needs no permission of its own: each
216
+ * field its mask names needs its field group's permission, the field's
217
+ * field_permission or, for a field without one, the method's permission.
218
+ * The caller needs at least one of them to make the call, and the
219
+ * handler checks each field the mask names before it writes; a mask that
220
+ * names nothing needs any one.
221
+ *
222
+ * @generated from extension: bool by_field = 51004;
223
+ */
224
+ export declare const by_field: GenExtension<MethodOptions, boolean>;
225
+ /**
226
+ * mcp sets how the call appears as a tool of the MCP server, where the
227
+ * rules its generator applies give the wrong answer. Without it a call
228
+ * whose permission's level is "read" is read-only and idempotent, a call
229
+ * whose name begins with Delete, Cancel, Revoke, Remove, Stop or Rollback
230
+ * is destructive, and no call reaches outside the workspace.
231
+ *
232
+ * @generated from extension: toshi.MCP mcp = 51005;
233
+ */
234
+ export declare const mcp: GenExtension<MethodOptions, MCP>;
235
+ /**
236
+ * field_permission names what a caller needs to change the field through
237
+ * the mask of an update call marked by_field: a field group of its own,
238
+ * such as "billing.write" for a workspace's spending limits. A field
239
+ * without it needs the method's permission. The build checks the name's
240
+ * shape, and the permissions page lists the field groups.
241
+ *
242
+ * @generated from extension: string field_permission = 51003;
243
+ */
244
+ export declare const field_permission: GenExtension<FieldOptions, string>;
@@ -1,12 +1,22 @@
1
1
  // @generated by protoc-gen-es v2.16.0 with parameter "target=ts,json_types=true,import_extension=js"
2
2
  // @generated from file toshi/permission.proto (package toshi, syntax proto3)
3
3
  /* eslint-disable */
4
- import { extDesc, fileDesc } from "@bufbuild/protobuf/codegenv2";
4
+ import { extDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
5
  import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt";
6
6
  /**
7
7
  * Describes the file toshi/permission.proto.
8
8
  */
9
- export const file_toshi_permission = /*@__PURE__*/ fileDesc("ChZ0b3NoaS9wZXJtaXNzaW9uLnByb3RvEgV0b3NoaTpACgpwZXJtaXNzaW9uEh4uZ29vZ2xlLnByb3RvYnVmLk1ldGhvZE9wdGlvbnMYuI4DIAEoCVIKcGVybWlzc2lvbjo2CgVzY29wZRIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGLmOAyABKAlSBXNjb3BlQh5aHGdvLnRvc2hpY2xvdWQuaW8vYXBpL3Rvc2hpcGJiBnByb3RvMw", [file_google_protobuf_descriptor]);
9
+ export const file_toshi_permission = /*@__PURE__*/ fileDesc("ChZ0b3NoaS9wZXJtaXNzaW9uLnByb3RvEgV0b3NoaSInCgVBdWRpdBIOCgZhY3Rpb24YASABKAkSDgoGdGFyZ2V0GAIgASgJIrYBCgNNQ1ASFgoJcmVhZF9vbmx5GAEgASgISACIAQESGAoLZGVzdHJ1Y3RpdmUYAiABKAhIAYgBARIXCgppZGVtcG90ZW50GAMgASgISAKIAQESFwoKb3Blbl93b3JsZBgEIAEoCEgDiAEBEg8KB2V4Y2x1ZGUYBSABKAhCDAoKX3JlYWRfb25seUIOCgxfZGVzdHJ1Y3RpdmVCDQoLX2lkZW1wb3RlbnRCDQoLX29wZW5fd29ybGQ6QAoKcGVybWlzc2lvbhIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGLiOAyABKAlSCnBlcm1pc3Npb246NgoFc2NvcGUSHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxi5jgMgASgJUgVzY29wZTpECgVhdWRpdBIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGLqOAyABKAsyDC50b3NoaS5BdWRpdFIFYXVkaXQ6OwoIYnlfZmllbGQSHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxi8jgMgASgIUgdieUZpZWxkOj4KA21jcBIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGL2OAyABKAsyCi50b3NoaS5NQ1BSA21jcDpKChBmaWVsZF9wZXJtaXNzaW9uEh0uZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucxi7jgMgASgJUg9maWVsZFBlcm1pc3Npb25CHlocZ28udG9zaGljbG91ZC5pby9hcGkvdG9zaGlwYmIGcHJvdG8z", [file_google_protobuf_descriptor]);
10
+ /**
11
+ * Describes the message toshi.Audit.
12
+ * Use `create(AuditSchema)` to create a new message.
13
+ */
14
+ export const AuditSchema = /*@__PURE__*/ messageDesc(file_toshi_permission, 0);
15
+ /**
16
+ * Describes the message toshi.MCP.
17
+ * Use `create(MCPSchema)` to create a new message.
18
+ */
19
+ export const MCPSchema = /*@__PURE__*/ messageDesc(file_toshi_permission, 1);
10
20
  /**
11
21
  * permission names what a caller needs to make the call: an area and a
12
22
  * level. "<area>.read" sees what the area holds and "<area>.write" changes
@@ -40,3 +50,45 @@ export const permission = /*@__PURE__*/ extDesc(file_toshi_permission, 0);
40
50
  * @generated from extension: string scope = 51001;
41
51
  */
42
52
  export const scope = /*@__PURE__*/ extDesc(file_toshi_permission, 1);
53
+ /**
54
+ * audit names the audit event a call records when its action or target
55
+ * is not the one its name gives. Every call that changes something
56
+ * records one event: on the Workspace API a call whose permission's level
57
+ * is not "read", on the operator API a call whose verb is not a read
58
+ * (Get, List, Watch, Wait, Summarise, Suggest, Export, Discover). A read
59
+ * whose option names an action records one too.
60
+ *
61
+ * @generated from extension: toshi.Audit audit = 51002;
62
+ */
63
+ export const audit = /*@__PURE__*/ extDesc(file_toshi_permission, 2);
64
+ /**
65
+ * by_field marks an update call that needs no permission of its own: each
66
+ * field its mask names needs its field group's permission, the field's
67
+ * field_permission or, for a field without one, the method's permission.
68
+ * The caller needs at least one of them to make the call, and the
69
+ * handler checks each field the mask names before it writes; a mask that
70
+ * names nothing needs any one.
71
+ *
72
+ * @generated from extension: bool by_field = 51004;
73
+ */
74
+ export const by_field = /*@__PURE__*/ extDesc(file_toshi_permission, 3);
75
+ /**
76
+ * mcp sets how the call appears as a tool of the MCP server, where the
77
+ * rules its generator applies give the wrong answer. Without it a call
78
+ * whose permission's level is "read" is read-only and idempotent, a call
79
+ * whose name begins with Delete, Cancel, Revoke, Remove, Stop or Rollback
80
+ * is destructive, and no call reaches outside the workspace.
81
+ *
82
+ * @generated from extension: toshi.MCP mcp = 51005;
83
+ */
84
+ export const mcp = /*@__PURE__*/ extDesc(file_toshi_permission, 4);
85
+ /**
86
+ * field_permission names what a caller needs to change the field through
87
+ * the mask of an update call marked by_field: a field group of its own,
88
+ * such as "billing.write" for a workspace's spending limits. A field
89
+ * without it needs the method's permission. The build checks the name's
90
+ * shape, and the permissions page lists the field groups.
91
+ *
92
+ * @generated from extension: string field_permission = 51003;
93
+ */
94
+ export const field_permission = /*@__PURE__*/ extDesc(file_toshi_permission, 5);