@distilled.cloud/namespacelabs 0.0.0-stage → 1.0.0-rc.20

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 (216) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +125 -2
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +55 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +33 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +42 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +7 -0
  16. package/lib/index.lazy.js +7 -0
  17. package/lib/index.lazy.js.map +1 -0
  18. package/lib/pagination.d.ts +2 -0
  19. package/lib/pagination.d.ts.map +1 -0
  20. package/lib/pagination.js +1 -0
  21. package/lib/protocol.d.ts +15 -0
  22. package/lib/protocol.d.ts.map +1 -0
  23. package/lib/protocol.js +1 -0
  24. package/lib/retry.d.ts +12 -0
  25. package/lib/retry.d.ts.map +1 -0
  26. package/lib/retry.js +1 -0
  27. package/lib/services/artifacts.d.ts +260 -0
  28. package/lib/services/artifacts.d.ts.map +1 -0
  29. package/lib/services/artifacts.js +2 -0
  30. package/lib/services/artifacts.js.map +1 -0
  31. package/lib/services/audit.d.ts +149 -0
  32. package/lib/services/audit.d.ts.map +1 -0
  33. package/lib/services/audit.js +2 -0
  34. package/lib/services/audit.js.map +1 -0
  35. package/lib/services/bazel.d.ts +173 -0
  36. package/lib/services/bazel.d.ts.map +1 -0
  37. package/lib/services/bazel.js +2 -0
  38. package/lib/services/bazel.js.map +1 -0
  39. package/lib/services/bazel_cache.d.ts +118 -0
  40. package/lib/services/bazel_cache.d.ts.map +1 -0
  41. package/lib/services/bazel_cache.js +2 -0
  42. package/lib/services/bazel_cache.js.map +1 -0
  43. package/lib/services/builder.d.ts +234 -0
  44. package/lib/services/builder.d.ts.map +1 -0
  45. package/lib/services/builder.js +2 -0
  46. package/lib/services/builder.js.map +1 -0
  47. package/lib/services/buildkite_jobs.d.ts +121 -0
  48. package/lib/services/buildkite_jobs.d.ts.map +1 -0
  49. package/lib/services/buildkite_jobs.js +2 -0
  50. package/lib/services/buildkite_jobs.js.map +1 -0
  51. package/lib/services/buildkite_queue.d.ts +178 -0
  52. package/lib/services/buildkite_queue.d.ts.map +1 -0
  53. package/lib/services/buildkite_queue.js +2 -0
  54. package/lib/services/buildkite_queue.js.map +1 -0
  55. package/lib/services/compute.d.ts +1057 -0
  56. package/lib/services/compute.d.ts.map +1 -0
  57. package/lib/services/compute.js +43 -0
  58. package/lib/services/compute.js.map +1 -0
  59. package/lib/services/compute_command.d.ts +112 -0
  60. package/lib/services/compute_command.d.ts.map +1 -0
  61. package/lib/services/compute_command.js +2 -0
  62. package/lib/services/compute_command.js.map +1 -0
  63. package/lib/services/compute_observability.d.ts +157 -0
  64. package/lib/services/compute_observability.d.ts.map +1 -0
  65. package/lib/services/compute_observability.js +2 -0
  66. package/lib/services/compute_observability.js.map +1 -0
  67. package/lib/services/compute_storage.d.ts +371 -0
  68. package/lib/services/compute_storage.d.ts.map +1 -0
  69. package/lib/services/compute_storage.js +33 -0
  70. package/lib/services/compute_storage.js.map +1 -0
  71. package/lib/services/compute_usage.d.ts +275 -0
  72. package/lib/services/compute_usage.d.ts.map +1 -0
  73. package/lib/services/compute_usage.js +2 -0
  74. package/lib/services/compute_usage.js.map +1 -0
  75. package/lib/services/egress.d.ts +183 -0
  76. package/lib/services/egress.d.ts.map +1 -0
  77. package/lib/services/egress.js +2 -0
  78. package/lib/services/egress.js.map +1 -0
  79. package/lib/services/experimental_compute_reservation.d.ts +662 -0
  80. package/lib/services/experimental_compute_reservation.d.ts.map +1 -0
  81. package/lib/services/experimental_compute_reservation.js +23 -0
  82. package/lib/services/experimental_compute_reservation.js.map +1 -0
  83. package/lib/services/experimental_remote_results.d.ts +488 -0
  84. package/lib/services/experimental_remote_results.d.ts.map +1 -0
  85. package/lib/services/experimental_remote_results.js +2 -0
  86. package/lib/services/experimental_remote_results.js.map +1 -0
  87. package/lib/services/github_image.d.ts +154 -0
  88. package/lib/services/github_image.d.ts.map +1 -0
  89. package/lib/services/github_image.js +2 -0
  90. package/lib/services/github_image.js.map +1 -0
  91. package/lib/services/github_jobs.d.ts +175 -0
  92. package/lib/services/github_jobs.d.ts.map +1 -0
  93. package/lib/services/github_jobs.js +2 -0
  94. package/lib/services/github_jobs.js.map +1 -0
  95. package/lib/services/github_profile.d.ts +288 -0
  96. package/lib/services/github_profile.d.ts.map +1 -0
  97. package/lib/services/github_profile.js +2 -0
  98. package/lib/services/github_profile.js.map +1 -0
  99. package/lib/services/gradle_cache.d.ts +117 -0
  100. package/lib/services/gradle_cache.d.ts.map +1 -0
  101. package/lib/services/gradle_cache.js +2 -0
  102. package/lib/services/gradle_cache.js.map +1 -0
  103. package/lib/services/httpcache.d.ts +117 -0
  104. package/lib/services/httpcache.d.ts.map +1 -0
  105. package/lib/services/httpcache.js +2 -0
  106. package/lib/services/httpcache.js.map +1 -0
  107. package/lib/services/iam_tenant.d.ts +373 -0
  108. package/lib/services/iam_tenant.d.ts.map +1 -0
  109. package/lib/services/iam_tenant.js +39 -0
  110. package/lib/services/iam_tenant.js.map +1 -0
  111. package/lib/services/iam_tenant_membership.d.ts +106 -0
  112. package/lib/services/iam_tenant_membership.d.ts.map +1 -0
  113. package/lib/services/iam_tenant_membership.js +2 -0
  114. package/lib/services/iam_tenant_membership.js.map +1 -0
  115. package/lib/services/iam_token.d.ts +249 -0
  116. package/lib/services/iam_token.d.ts.map +1 -0
  117. package/lib/services/iam_token.js +2 -0
  118. package/lib/services/iam_token.js.map +1 -0
  119. package/lib/services/image.d.ts +214 -0
  120. package/lib/services/image.d.ts.map +1 -0
  121. package/lib/services/image.js +2 -0
  122. package/lib/services/image.js.map +1 -0
  123. package/lib/services/index.d.ts +30 -0
  124. package/lib/services/index.d.ts.map +1 -0
  125. package/lib/services/index.js +29 -0
  126. package/lib/services/private_devbox.d.ts +1156 -0
  127. package/lib/services/private_devbox.d.ts.map +1 -0
  128. package/lib/services/private_devbox.js +81 -0
  129. package/lib/services/private_devbox.js.map +1 -0
  130. package/lib/services/private_user_sessions.d.ts +137 -0
  131. package/lib/services/private_user_sessions.d.ts.map +1 -0
  132. package/lib/services/private_user_sessions.js +2 -0
  133. package/lib/services/private_user_sessions.js.map +1 -0
  134. package/lib/services/registry.d.ts +365 -0
  135. package/lib/services/registry.d.ts.map +1 -0
  136. package/lib/services/registry.js +34 -0
  137. package/lib/services/registry.js.map +1 -0
  138. package/lib/services/testing.d.ts +152 -0
  139. package/lib/services/testing.d.ts.map +1 -0
  140. package/lib/services/testing.js +2 -0
  141. package/lib/services/testing.js.map +1 -0
  142. package/lib/services/vault.d.ts +195 -0
  143. package/lib/services/vault.d.ts.map +1 -0
  144. package/lib/services/vault.js +2 -0
  145. package/lib/services/vault.js.map +1 -0
  146. package/lib/services.lazy/artifacts.js +1 -0
  147. package/lib/services.lazy/audit.js +1 -0
  148. package/lib/services.lazy/bazel.js +1 -0
  149. package/lib/services.lazy/bazel_cache.js +1 -0
  150. package/lib/services.lazy/builder.js +1 -0
  151. package/lib/services.lazy/buildkite_jobs.js +1 -0
  152. package/lib/services.lazy/buildkite_queue.js +1 -0
  153. package/lib/services.lazy/compute.js +4 -0
  154. package/lib/services.lazy/compute_command.js +1 -0
  155. package/lib/services.lazy/compute_observability.js +1 -0
  156. package/lib/services.lazy/compute_storage.js +4 -0
  157. package/lib/services.lazy/compute_usage.js +1 -0
  158. package/lib/services.lazy/egress.js +1 -0
  159. package/lib/services.lazy/experimental_compute_reservation.js +4 -0
  160. package/lib/services.lazy/experimental_remote_results.js +1 -0
  161. package/lib/services.lazy/github_image.js +1 -0
  162. package/lib/services.lazy/github_jobs.js +1 -0
  163. package/lib/services.lazy/github_profile.js +1 -0
  164. package/lib/services.lazy/gradle_cache.js +1 -0
  165. package/lib/services.lazy/httpcache.js +1 -0
  166. package/lib/services.lazy/iam_tenant.js +4 -0
  167. package/lib/services.lazy/iam_tenant_membership.js +1 -0
  168. package/lib/services.lazy/iam_token.js +1 -0
  169. package/lib/services.lazy/image.js +1 -0
  170. package/lib/services.lazy/index.js +3 -0
  171. package/lib/services.lazy/private_devbox.js +4 -0
  172. package/lib/services.lazy/private_user_sessions.js +1 -0
  173. package/lib/services.lazy/registry.js +4 -0
  174. package/lib/services.lazy/testing.js +1 -0
  175. package/lib/services.lazy/vault.js +1 -0
  176. package/lib/traits.d.ts +3 -0
  177. package/lib/traits.d.ts.map +1 -0
  178. package/lib/traits.js +1 -0
  179. package/package.json +87 -3
  180. package/src/credentials.ts +164 -0
  181. package/src/errors.ts +47 -0
  182. package/src/index.ts +48 -0
  183. package/src/pagination.ts +1 -0
  184. package/src/protocol.ts +82 -0
  185. package/src/retry.ts +28 -0
  186. package/src/services/artifacts.ts +761 -0
  187. package/src/services/audit.ts +315 -0
  188. package/src/services/bazel.ts +415 -0
  189. package/src/services/bazel_cache.ts +211 -0
  190. package/src/services/builder.ts +568 -0
  191. package/src/services/buildkite_jobs.ts +222 -0
  192. package/src/services/buildkite_queue.ts +445 -0
  193. package/src/services/compute.ts +2794 -0
  194. package/src/services/compute_command.ts +212 -0
  195. package/src/services/compute_observability.ts +428 -0
  196. package/src/services/compute_storage.ts +1159 -0
  197. package/src/services/compute_usage.ts +730 -0
  198. package/src/services/egress.ts +508 -0
  199. package/src/services/experimental_compute_reservation.ts +1488 -0
  200. package/src/services/experimental_remote_results.ts +1157 -0
  201. package/src/services/github_image.ts +293 -0
  202. package/src/services/github_jobs.ts +381 -0
  203. package/src/services/github_profile.ts +721 -0
  204. package/src/services/gradle_cache.ts +263 -0
  205. package/src/services/httpcache.ts +263 -0
  206. package/src/services/iam_tenant.ts +1355 -0
  207. package/src/services/iam_tenant_membership.ts +245 -0
  208. package/src/services/iam_token.ts +780 -0
  209. package/src/services/image.ts +594 -0
  210. package/src/services/index.ts +30 -0
  211. package/src/services/private_devbox.ts +4217 -0
  212. package/src/services/private_user_sessions.ts +402 -0
  213. package/src/services/registry.ts +1234 -0
  214. package/src/services/testing.ts +386 -0
  215. package/src/services/vault.ts +514 -0
  216. package/src/traits.ts +36 -0
@@ -0,0 +1,780 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ import * as C from "@distilled.cloud/core/category";
3
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (buf.build/namespace/cloud -> smithy). Do not edit.
4
+ import * as S from "@distilled.cloud/core/schema-lite";
5
+ import * as __L from "@distilled.cloud/core/schema-lite";
6
+ import type * as Redacted from "effect/Redacted";
7
+ import { UnknownNamespaceLabsError } from "../errors.ts";
8
+ import { paginateCursor } from "../pagination.ts";
9
+ import {
10
+ NamespaceLabsProtocol,
11
+ type NamespaceLabsOpError,
12
+ type NamespaceLabsOpContext,
13
+ } from "../protocol.ts";
14
+ import * as Retry from "../retry.ts";
15
+ import * as T from "../traits.ts";
16
+ // Schema table, filled on first reach (see __S at the end).
17
+ const __s: any[] = [];
18
+
19
+ export type { NamespaceLabsOpError, NamespaceLabsOpContext };
20
+
21
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
22
+ const TELEMETRY = {
23
+ system: "namespacelabs-api",
24
+ responseHeaders: [
25
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
26
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
27
+ ],
28
+ prefix: "Namespacelabs",
29
+ service: "TokenService",
30
+ propagate: "w3c",
31
+ } as const;
32
+
33
+ export class AlreadyExists
34
+ extends /*@__PURE__*/ T.applyErrorMatchers(
35
+ /*@__PURE__*/ S.TaggedError<AlreadyExists>()("AlreadyExists", {
36
+ message: S.String,
37
+ body: S.Unknown,
38
+ }).pipe(C.withConflictError),
39
+ [{ status: 409, body: { "/code": "already_exists" } }],
40
+ ) {}
41
+
42
+ export class FailedPrecondition
43
+ extends /*@__PURE__*/ T.applyErrorMatchers(
44
+ /*@__PURE__*/ S.TaggedError<FailedPrecondition>()("FailedPrecondition", {
45
+ message: S.String,
46
+ body: S.Unknown,
47
+ }).pipe(C.withBadRequestError),
48
+ [{ status: 400, body: { "/code": "failed_precondition" } }],
49
+ ) {}
50
+
51
+ export class InvalidArgument
52
+ extends /*@__PURE__*/ T.applyErrorMatchers(
53
+ /*@__PURE__*/ S.TaggedError<InvalidArgument>()("InvalidArgument", {
54
+ message: S.String,
55
+ body: S.Unknown,
56
+ }).pipe(C.withBadRequestError),
57
+ [{ status: 400, body: { "/code": "invalid_argument" } }],
58
+ ) {}
59
+
60
+ export class NotFound
61
+ extends /*@__PURE__*/ T.applyErrorMatchers(
62
+ /*@__PURE__*/ S.TaggedError<NotFound>()("NotFound", {
63
+ message: S.String,
64
+ body: S.Unknown,
65
+ }).pipe(C.withBadRequestError),
66
+ [{ status: 404 }],
67
+ ) {}
68
+
69
+ export class PermissionDenied
70
+ extends /*@__PURE__*/ T.applyErrorMatchers(
71
+ /*@__PURE__*/ S.TaggedError<PermissionDenied>()("PermissionDenied", {
72
+ message: S.String,
73
+ body: S.Unknown,
74
+ }).pipe(C.withAuthError),
75
+ [{ status: 403 }],
76
+ ) {}
77
+
78
+ export class ResourceExhausted
79
+ extends /*@__PURE__*/ T.applyErrorMatchers(
80
+ /*@__PURE__*/ S.TaggedError<ResourceExhausted>()("ResourceExhausted", {
81
+ message: S.String,
82
+ body: S.Unknown,
83
+ }).pipe(C.withThrottlingError),
84
+ [{ status: 429 }],
85
+ ) {}
86
+
87
+ export class Unauthenticated
88
+ extends /*@__PURE__*/ T.applyErrorMatchers(
89
+ /*@__PURE__*/ S.TaggedError<Unauthenticated>()("Unauthenticated", {
90
+ message: S.String,
91
+ body: S.Unknown,
92
+ }).pipe(C.withAuthError),
93
+ [{ status: 401 }],
94
+ ) {}
95
+
96
+ export type RevokableTokenScope = "SCOPE_UNKNOWN" | "TENANT_SCOPE" | "TENANT_MEMBERSHIP_SCOPE";
97
+ export interface BatchRevokeRevokableTokenRequest {
98
+ /** Revoke tokens created before this timestamp. If not set, no time-based filtering is applied. */
99
+ before?: string | undefined;
100
+ /** Revoke tokens created by this actor_id (only applies to user actors). If not set, no actor-based filtering is applied. */
101
+ createdByActorId?: string | undefined;
102
+ /** Revoke tokens with the selected scope only. If not set, no scope-based filtering is applied. */
103
+ scope?: RevokableTokenScope | (string & {}) | undefined;
104
+ }
105
+ export type StringList = Array<string>;
106
+ export interface BatchRevokeRevokableTokenResponse {
107
+ /** The IDs of the tokens that were revoked (prefixed with "tok_"). */
108
+ revokedTokenIds: StringList;
109
+ }
110
+ export interface TenantTokenPolicy {
111
+ /** The policy type being set. Consult with the Namespace team on which controls can be applied per tenant token. */
112
+ policyType?: string | undefined;
113
+ /** The policy-specific value. It may be a string, number, or serialized message (e.g. JSON). */
114
+ value?: string | undefined;
115
+ }
116
+ export type TenantTokenPolicyList = Array<TenantTokenPolicy>;
117
+ /** Defines a permission grant on a resource. Permissions are used to restrict what a token is allowed to do. See https://namespace.so/docs/security/permissions for a list of available resource types and actions. */
118
+ export interface Permission {
119
+ /** The type of resource this permission applies to, e.g. "instance", "vault/object", "token/revokable". */
120
+ resourceType?: string | undefined;
121
+ /** The specific resource ID, or empty for all resources of this type. */
122
+ resourceId?: string | undefined;
123
+ /** The set of actions allowed on the resource, e.g. "create", "list", "describe". */
124
+ actions?: StringList | undefined;
125
+ }
126
+ export type PermissionList = Array<Permission>;
127
+ export interface AccessPolicy {
128
+ /** Grant a restricted set of permissions to this token. See https://namespace.so/docs/security/permissions for available permissions. */
129
+ grants?: PermissionList | undefined;
130
+ }
131
+ export interface CreateRevokableTokenRequest {
132
+ /** A unique name for the token within the tenant. Required. */
133
+ name?: string | undefined;
134
+ /** A human-readable description of the token's purpose. */
135
+ description?: string | undefined;
136
+ /** When the token should expire. Maximum expiration is 1 year from creation. May be omitted for membership-scoped tokens to create a token with unlimited duration. */
137
+ expiresAt?: string | undefined;
138
+ /** A set of policies that apply to this token. */
139
+ policies?: TenantTokenPolicyList | undefined;
140
+ /** Configure the access permissions available with this token. */
141
+ access?: AccessPolicy | undefined;
142
+ /** Allows restricting the scope of the issued token. */
143
+ scope?: RevokableTokenScope | (string & {}) | undefined;
144
+ }
145
+ export type RevokableTokenState = "STATE_UNKNOWN" | "ACTIVE" | "REVOKED" | "EXPIRED";
146
+ export interface RevokableToken {
147
+ /** The unique identifier for this token, prefixed with "tok_". This is used for revocation. */
148
+ tokenId: string;
149
+ /** The tenant this token belongs to. */
150
+ tenantId: string;
151
+ /** A unique name for the token within the tenant. */
152
+ name: string;
153
+ /** A human-readable description of the token's purpose. */
154
+ description: string;
155
+ /** When the token was created. */
156
+ createdAt?: string | undefined;
157
+ /** When the token expires. Tokens are implicitly invalid after this time. If omitted, the membership-scoped token has unlimited duration. */
158
+ expiresAt?: string | undefined;
159
+ /** If set, when the token was explicitly revoked. */
160
+ revokedAt?: string | undefined;
161
+ /** If set, the actor who revoked the token. */
162
+ revokedByActorId: string;
163
+ /** The actor who created this token. */
164
+ creatorActorId: string;
165
+ /** Indicates whether the token is bound to a particular membership, or tenant-wide. */
166
+ scope: RevokableTokenScope;
167
+ /** The permissions granted to this token. */
168
+ permissions: PermissionList;
169
+ /** The current state of the token. */
170
+ state: RevokableTokenState;
171
+ }
172
+ export interface CreateRevokableTokenResponse {
173
+ /** The bearer token that can be used for authentication. This value is only returned once at creation time and cannot be retrieved later. */
174
+ bearerToken: string | Redacted.Redacted<string>;
175
+ /** The token metadata, including the token_id (prefixed with "tok_") which can be used to revoke or list the token. */
176
+ token?: RevokableToken | undefined;
177
+ }
178
+ export interface IssueIdTokenRequest {
179
+ /** Target audience for the generated identity token. */
180
+ audience?: string | undefined;
181
+ }
182
+ export interface IssueIdTokenResponse {
183
+ /** The signed OIDC ID token. Use this token to authenticate with external services that trust the Namespace federation issuer (`https://federation.namespaceapis.com`). */
184
+ idToken: string | Redacted.Redacted<string>;
185
+ }
186
+ export interface IssueTenantTokenRequest {
187
+ /** Which tenant credentials should be produced for. */
188
+ tenantId?: string | undefined;
189
+ /** A integration-specified identifier that represents the user that is requesting these credentials. The actor identity is embedded into the verifiable claims of the resulting JWT. */
190
+ actorId?: string | undefined;
191
+ /** For how long should the resulting credentials be valid for. If not specified, a short-lived default is used (e.g 15mins). */
192
+ durationSecs?: string | undefined;
193
+ /** A set of policies that apply to this tenant token. */
194
+ policies?: TenantTokenPolicyList | undefined;
195
+ /** Configure the access permissions available with this token. */
196
+ access?: AccessPolicy | undefined;
197
+ }
198
+ export interface IssueTenantTokenResponse {
199
+ /** The tenant Bearer token. Pass this in the `Authorization: Bearer {token}` header when calling Namespace APIs. */
200
+ bearerToken: string | Redacted.Redacted<string>;
201
+ }
202
+ export interface IssueTenantTokenWithOIDCRequest {
203
+ /** Which tenant credentials should be produced for. */
204
+ tenantId?: string | undefined;
205
+ /** The OIDC token from a trusted external issuer. */
206
+ oidcToken?: string | Redacted.Redacted<string> | undefined;
207
+ /** For how long the resulting credentials should be valid. */
208
+ duration?: string | undefined;
209
+ }
210
+ export interface IssueTenantTokenWithOIDCResponse {
211
+ /** The tenant Bearer token. Pass this in the `Authorization: Bearer {token}` header when calling Namespace APIs. */
212
+ bearerToken: string | Redacted.Redacted<string>;
213
+ }
214
+ export interface ListRevokableTokensRequest {
215
+ /** If a previous response returned a `pagination_cursor`, it can be specified to continue reading results with the same arguments as the original call. */
216
+ paginationCursor?: string | undefined;
217
+ /** The maximum number of entries to return as part of this ListRevokableTokens request. A maximum number of entries may also be specified when `pagination_cursor` is set. We won't return more than `max_entries`, but may return fewer. */
218
+ maxEntries?: string | undefined;
219
+ /** If true, include revoked tokens in the results. */
220
+ includeRevoked?: boolean | undefined;
221
+ }
222
+ export type RevokableTokenList = Array<RevokableToken>;
223
+ export interface ListRevokableTokensResponse {
224
+ /** The list of revokable tokens. */
225
+ tokens: RevokableTokenList;
226
+ /** If set, there are additional results. Pass the same cursor to a subsequent ListRevokableTokens call to continue fetching results. */
227
+ paginationCursor: string;
228
+ }
229
+ export interface RefreshRevokableTokenRequest {
230
+ /** The unique identifier of the token to refresh, prefixed with "tok_". */
231
+ tokenId?: string | undefined;
232
+ /** Ensure the token remains valid for at least this much longer. Maximum duration is 1 year. */
233
+ minimumDuration?: string | undefined;
234
+ }
235
+ export interface RefreshRevokableTokenResponse {
236
+ /** The refreshed token metadata. */
237
+ token?: RevokableToken | undefined;
238
+ }
239
+ export interface RevokeRevokableTokenRequest {
240
+ /** The unique identifier of the token to revoke, prefixed with "tok_". */
241
+ tokenId?: string | undefined;
242
+ }
243
+ export interface RevokeRevokableTokenResponse {}
244
+ export type BatchRevokeRevokableTokenError =
245
+ | InvalidArgument
246
+ | FailedPrecondition
247
+ | Unauthenticated
248
+ | PermissionDenied
249
+ | NotFound
250
+ | AlreadyExists
251
+ | ResourceExhausted
252
+ | NamespaceLabsOpError;
253
+ /** Batch revokes multiple revokable tokens based on filter criteria. At least one filter must be provided. ### Authentication Requires a tenant token with the {"token/revokable", "revoke"} action permission. ### Errors - If no filters are provided, an `InvalidArgument` status is returned. */
254
+ export const batchRevokeRevokableToken: API.OperationMethod<
255
+ BatchRevokeRevokableTokenRequest,
256
+ BatchRevokeRevokableTokenResponse,
257
+ BatchRevokeRevokableTokenError,
258
+ NamespaceLabsOpContext
259
+ > = /*@__PURE__*/ API.make(() => ({
260
+ input: __S(24, __c6, 0) as any as S.Schema<BatchRevokeRevokableTokenRequest>,
261
+ output: __S(25, __c6, 1) as any as S.Schema<BatchRevokeRevokableTokenResponse>,
262
+ errors: [
263
+ InvalidArgument,
264
+ FailedPrecondition,
265
+ Unauthenticated,
266
+ PermissionDenied,
267
+ NotFound,
268
+ AlreadyExists,
269
+ ResourceExhausted,
270
+ UnknownNamespaceLabsError,
271
+ ],
272
+ protocol: NamespaceLabsProtocol,
273
+ retry: Retry.Retry,
274
+ telemetry: TELEMETRY,
275
+ span: "BatchRevokeRevokableToken",
276
+ }));
277
+
278
+ export type CreateRevokableTokenError =
279
+ | InvalidArgument
280
+ | FailedPrecondition
281
+ | Unauthenticated
282
+ | PermissionDenied
283
+ | NotFound
284
+ | AlreadyExists
285
+ | ResourceExhausted
286
+ | NamespaceLabsOpError;
287
+ /** Creates a revokable token that returns a bearer token (prefixed with "nsrt_") and metadata (with token_id prefixed with "tok_"). Revokable tokens can be explicitly revoked and have a maximum expiration of 1 year when an expiration is set. Membership-scoped tokens may have no expiration and remain valid until revoked or the user loses tenant membership. ### Authentication Requires a tenant token with the {"token/revokable", "create"} action permission. ### Errors - If expiry is not provided for a tenant-scoped token or exceeds 1 year, an `InvalidArgument` status is returned. - If no policies are defined, an `InvalidArgument` status is returned. */
288
+ export const createRevokableToken: API.OperationMethod<
289
+ CreateRevokableTokenRequest,
290
+ CreateRevokableTokenResponse,
291
+ CreateRevokableTokenError,
292
+ NamespaceLabsOpContext
293
+ > = /*@__PURE__*/ API.make(() => ({
294
+ input: __S(32, __c8, 0) as any as S.Schema<CreateRevokableTokenRequest>,
295
+ output: __S(33, __c8, 1) as any as S.Schema<CreateRevokableTokenResponse>,
296
+ errors: [
297
+ InvalidArgument,
298
+ FailedPrecondition,
299
+ Unauthenticated,
300
+ PermissionDenied,
301
+ NotFound,
302
+ AlreadyExists,
303
+ ResourceExhausted,
304
+ UnknownNamespaceLabsError,
305
+ ],
306
+ protocol: NamespaceLabsProtocol,
307
+ retry: Retry.Retry,
308
+ telemetry: TELEMETRY,
309
+ span: "CreateRevokableToken",
310
+ }));
311
+
312
+ export type IssueIdTokenError =
313
+ | InvalidArgument
314
+ | FailedPrecondition
315
+ | Unauthenticated
316
+ | PermissionDenied
317
+ | NotFound
318
+ | AlreadyExists
319
+ | ResourceExhausted
320
+ | NamespaceLabsOpError;
321
+ /** Exchange a Namespace tenant token for an OIDC token for identity federation. The generated token identifies Namespace tenants with the provided target audience. ### Authentication Requires a tenant token with the {"federation", "issue_federation"} action permission. ### Errors - If no audience is provided, a `InvalidArgument` status is returned. */
322
+ export const issueIdToken: API.OperationMethod<
323
+ IssueIdTokenRequest,
324
+ IssueIdTokenResponse,
325
+ IssueIdTokenError,
326
+ NamespaceLabsOpContext
327
+ > = /*@__PURE__*/ API.make(() => ({
328
+ input: __S(48, __c12, 0) as any as S.Schema<IssueIdTokenRequest>,
329
+ output: __S(49, __c12, 1) as any as S.Schema<IssueIdTokenResponse>,
330
+ errors: [
331
+ InvalidArgument,
332
+ FailedPrecondition,
333
+ Unauthenticated,
334
+ PermissionDenied,
335
+ NotFound,
336
+ AlreadyExists,
337
+ ResourceExhausted,
338
+ UnknownNamespaceLabsError,
339
+ ],
340
+ protocol: NamespaceLabsProtocol,
341
+ retry: Retry.Retry,
342
+ telemetry: TELEMETRY,
343
+ span: "IssueIdToken",
344
+ }));
345
+
346
+ export type IssueTenantTokenError =
347
+ | InvalidArgument
348
+ | FailedPrecondition
349
+ | Unauthenticated
350
+ | PermissionDenied
351
+ | NotFound
352
+ | AlreadyExists
353
+ | ResourceExhausted
354
+ | NamespaceLabsOpError;
355
+ /** Produces credentials in the form of a Bearer token that grant access to the specified Tenant. The credentials provided to the `IssueTenantToken` call are validated to verify they are capable of requesting credentials. ### Authentication Requires a "partner token". */
356
+ export const issueTenantToken: API.OperationMethod<
357
+ IssueTenantTokenRequest,
358
+ IssueTenantTokenResponse,
359
+ IssueTenantTokenError,
360
+ NamespaceLabsOpContext
361
+ > = /*@__PURE__*/ API.make(() => ({
362
+ input: __S(0, __c0, 0) as any as S.Schema<IssueTenantTokenRequest>,
363
+ output: __S(4, __c1, 0) as any as S.Schema<IssueTenantTokenResponse>,
364
+ errors: [
365
+ InvalidArgument,
366
+ FailedPrecondition,
367
+ Unauthenticated,
368
+ PermissionDenied,
369
+ NotFound,
370
+ AlreadyExists,
371
+ ResourceExhausted,
372
+ UnknownNamespaceLabsError,
373
+ ],
374
+ protocol: NamespaceLabsProtocol,
375
+ retry: Retry.Retry,
376
+ telemetry: TELEMETRY,
377
+ span: "IssueTenantToken",
378
+ }));
379
+
380
+ export type IssueTenantTokenWithOIDCError =
381
+ | InvalidArgument
382
+ | FailedPrecondition
383
+ | Unauthenticated
384
+ | PermissionDenied
385
+ | NotFound
386
+ | AlreadyExists
387
+ | ResourceExhausted
388
+ | NamespaceLabsOpError;
389
+ /** Produces credentials in the form of a Bearer token that grant access to the specified Tenant using an OIDC token from a trusted issuer. ### Authentication This call authenticates using the `oidc_token` provided in the request. */
390
+ export const issueTenantTokenWithOIDC: API.OperationMethod<
391
+ IssueTenantTokenWithOIDCRequest,
392
+ IssueTenantTokenWithOIDCResponse,
393
+ IssueTenantTokenWithOIDCError,
394
+ NamespaceLabsOpContext
395
+ > = /*@__PURE__*/ API.make(() => ({
396
+ input: __S(8, __c2, 0) as any as S.Schema<IssueTenantTokenWithOIDCRequest>,
397
+ output: __S(4, __c1, 0) as any as S.Schema<IssueTenantTokenWithOIDCResponse>,
398
+ errors: [
399
+ InvalidArgument,
400
+ FailedPrecondition,
401
+ Unauthenticated,
402
+ PermissionDenied,
403
+ NotFound,
404
+ AlreadyExists,
405
+ ResourceExhausted,
406
+ UnknownNamespaceLabsError,
407
+ ],
408
+ protocol: NamespaceLabsProtocol,
409
+ retry: Retry.Retry,
410
+ telemetry: TELEMETRY,
411
+ span: "IssueTenantTokenWithOIDC",
412
+ }));
413
+
414
+ export type ListRevokableTokensError =
415
+ | InvalidArgument
416
+ | FailedPrecondition
417
+ | Unauthenticated
418
+ | PermissionDenied
419
+ | NotFound
420
+ | AlreadyExists
421
+ | ResourceExhausted
422
+ | NamespaceLabsOpError;
423
+ /** Lists all revokable tokens for the authenticated tenant. ### Authentication Requires a tenant token with the {"token/revokable", "list"} action permission. */
424
+ export const listRevokableTokens: API.PaginatedOperationMethod<
425
+ ListRevokableTokensRequest,
426
+ ListRevokableTokensResponse,
427
+ ListRevokableTokensError,
428
+ NamespaceLabsOpContext,
429
+ RevokableToken
430
+ > = /*@__PURE__*/ API.makePaginated(
431
+ () => ({
432
+ input: __S(12, __c3, 0) as any as S.Schema<ListRevokableTokensRequest>,
433
+ output: __S(14, __c3, 2) as any as S.Schema<ListRevokableTokensResponse>,
434
+ errors: [
435
+ InvalidArgument,
436
+ FailedPrecondition,
437
+ Unauthenticated,
438
+ PermissionDenied,
439
+ NotFound,
440
+ AlreadyExists,
441
+ ResourceExhausted,
442
+ UnknownNamespaceLabsError,
443
+ ],
444
+ protocol: NamespaceLabsProtocol,
445
+ retry: Retry.Retry,
446
+ telemetry: TELEMETRY,
447
+ span: "ListRevokableTokens",
448
+ pagination: {
449
+ mode: "cursor",
450
+ inputToken: "paginationCursor",
451
+ outputToken: "paginationCursor",
452
+ items: "tokens",
453
+ } as const,
454
+ }),
455
+ paginateCursor,
456
+ ) as any;
457
+
458
+ export type RefreshRevokableTokenError =
459
+ | InvalidArgument
460
+ | FailedPrecondition
461
+ | Unauthenticated
462
+ | PermissionDenied
463
+ | NotFound
464
+ | AlreadyExists
465
+ | ResourceExhausted
466
+ | NamespaceLabsOpError;
467
+ /** Ensures a revokable token has at least the requested remaining lifetime. Refreshing does not return a new bearer token; it updates the existing token's expiry in place. ### Authentication Requires a tenant token with the {"token/revokable", "refresh"} action permission. ### Errors - If `minimum_duration` is missing, non-positive, or exceeds 1 year, an `InvalidArgument` status is returned. - If the token_id is not found or already revoked, a `NotFound` status is returned. - If the token has already expired, a `FailedPrecondition` status is returned. */
468
+ export const refreshRevokableToken: API.OperationMethod<
469
+ RefreshRevokableTokenRequest,
470
+ RefreshRevokableTokenResponse,
471
+ RefreshRevokableTokenError,
472
+ NamespaceLabsOpContext
473
+ > = /*@__PURE__*/ API.make(() => ({
474
+ input: __S(16, __c4, 0) as any as S.Schema<RefreshRevokableTokenRequest>,
475
+ output: __S(17, __c4, 1) as any as S.Schema<RefreshRevokableTokenResponse>,
476
+ errors: [
477
+ InvalidArgument,
478
+ FailedPrecondition,
479
+ Unauthenticated,
480
+ PermissionDenied,
481
+ NotFound,
482
+ AlreadyExists,
483
+ ResourceExhausted,
484
+ UnknownNamespaceLabsError,
485
+ ],
486
+ protocol: NamespaceLabsProtocol,
487
+ retry: Retry.Retry,
488
+ telemetry: TELEMETRY,
489
+ span: "RefreshRevokableToken",
490
+ }));
491
+
492
+ export type RevokeRevokableTokenError =
493
+ | InvalidArgument
494
+ | FailedPrecondition
495
+ | Unauthenticated
496
+ | PermissionDenied
497
+ | NotFound
498
+ | AlreadyExists
499
+ | ResourceExhausted
500
+ | NamespaceLabsOpError;
501
+ /** Revokes a revokable token by its token_id (prefixed with "tok_"), preventing the associated bearer token from being used for authentication. Records who revoked the token and when. ### Authentication Requires a tenant token with the {"token/revokable", "revoke"} action permission. ### Errors - If the token_id is not found or already revoked, a `NotFound` status is returned. */
502
+ export const revokeRevokableToken: API.OperationMethod<
503
+ RevokeRevokableTokenRequest,
504
+ RevokeRevokableTokenResponse,
505
+ RevokeRevokableTokenError,
506
+ NamespaceLabsOpContext
507
+ > = /*@__PURE__*/ API.make(() => ({
508
+ input: __S(20, __c5, 0) as any as S.Schema<RevokeRevokableTokenRequest>,
509
+ output: __S(21, __c5, 1) as any as S.Schema<RevokeRevokableTokenResponse>,
510
+ errors: [
511
+ InvalidArgument,
512
+ FailedPrecondition,
513
+ Unauthenticated,
514
+ PermissionDenied,
515
+ NotFound,
516
+ AlreadyExists,
517
+ ResourceExhausted,
518
+ UnknownNamespaceLabsError,
519
+ ],
520
+ protocol: NamespaceLabsProtocol,
521
+ retry: Retry.Retry,
522
+ telemetry: TELEMETRY,
523
+ span: "RevokeRevokableToken",
524
+ }));
525
+
526
+ // Schema builders: each runs one schema initializer, on that schema's first use.
527
+ function __c0(j: number): any {
528
+ switch (j) {
529
+ case 0:
530
+ return S.suspend(() =>
531
+ S.Struct({
532
+ tenantId: S.optional(S.String),
533
+ actorId: S.optional(S.String),
534
+ durationSecs: S.optional(S.String),
535
+ policies: S.optional(__S(37, __c9, 1)),
536
+ access: S.optional(__S(38, __c9, 2)),
537
+ }).pipe(
538
+ T.Http({
539
+ method: "POST",
540
+ uri: "/namespace.cloud.iam.v1beta.TokenService/IssueTenantToken",
541
+ code: 200,
542
+ }),
543
+ ),
544
+ ).annotate({ identifier: "IssueTenantTokenRequest" });
545
+ }
546
+ }
547
+ function __c1(j: number): any {
548
+ switch (j) {
549
+ case 0:
550
+ return S.suspend(() =>
551
+ S.Struct({
552
+ bearerToken: S.String.pipe(T.SensitiveValue({})),
553
+ }),
554
+ ).annotate({ identifier: "IssueTenantTokenResponse" });
555
+ }
556
+ }
557
+ function __c2(j: number): any {
558
+ switch (j) {
559
+ case 0:
560
+ return S.suspend(() =>
561
+ S.Struct({
562
+ tenantId: S.optional(S.String),
563
+ oidcToken: S.optional(S.String.pipe(T.SensitiveValue({}))),
564
+ duration: S.optional(S.String),
565
+ }).pipe(
566
+ T.Http({
567
+ method: "POST",
568
+ uri: "/namespace.cloud.iam.v1beta.TokenService/IssueTenantTokenWithOIDC",
569
+ code: 200,
570
+ }),
571
+ ),
572
+ ).annotate({ identifier: "IssueTenantTokenWithOIDCRequest" });
573
+ }
574
+ }
575
+ function __c3(j: number): any {
576
+ switch (j) {
577
+ case 0:
578
+ return S.suspend(() =>
579
+ S.Struct({
580
+ paginationCursor: S.optional(S.String),
581
+ maxEntries: S.optional(S.String),
582
+ includeRevoked: S.optional(S.Boolean),
583
+ }).pipe(
584
+ T.Http({
585
+ method: "POST",
586
+ uri: "/namespace.cloud.iam.v1beta.TokenService/ListRevokableTokens",
587
+ code: 200,
588
+ }),
589
+ ),
590
+ ).annotate({ identifier: "ListRevokableTokensRequest" });
591
+ case 1:
592
+ return S.Array(__S(44, __c11, 0));
593
+ case 2:
594
+ return S.suspend(() =>
595
+ S.Struct({
596
+ tokens: __S(13, __c3, 1),
597
+ paginationCursor: S.String,
598
+ }),
599
+ ).annotate({ identifier: "ListRevokableTokensResponse" });
600
+ }
601
+ }
602
+ function __c4(j: number): any {
603
+ switch (j) {
604
+ case 0:
605
+ return S.suspend(() =>
606
+ S.Struct({
607
+ tokenId: S.optional(S.String),
608
+ minimumDuration: S.optional(S.String),
609
+ }).pipe(
610
+ T.Http({
611
+ method: "POST",
612
+ uri: "/namespace.cloud.iam.v1beta.TokenService/RefreshRevokableToken",
613
+ code: 200,
614
+ }),
615
+ ),
616
+ ).annotate({ identifier: "RefreshRevokableTokenRequest" });
617
+ case 1:
618
+ return S.suspend(() =>
619
+ S.Struct({
620
+ token: S.optional(__S(44, __c11, 0)),
621
+ }),
622
+ ).annotate({ identifier: "RefreshRevokableTokenResponse" });
623
+ }
624
+ }
625
+ function __c5(j: number): any {
626
+ switch (j) {
627
+ case 0:
628
+ return S.suspend(() =>
629
+ S.Struct({
630
+ tokenId: S.optional(S.String),
631
+ }).pipe(
632
+ T.Http({
633
+ method: "POST",
634
+ uri: "/namespace.cloud.iam.v1beta.TokenService/RevokeRevokableToken",
635
+ code: 200,
636
+ }),
637
+ ),
638
+ ).annotate({ identifier: "RevokeRevokableTokenRequest" });
639
+ case 1:
640
+ return S.suspend(() => S.Struct({})).annotate({ identifier: "RevokeRevokableTokenResponse" });
641
+ }
642
+ }
643
+ function __c6(j: number): any {
644
+ switch (j) {
645
+ case 0:
646
+ return S.suspend(() =>
647
+ S.Struct({
648
+ before: S.optional(S.String),
649
+ createdByActorId: S.optional(S.String),
650
+ scope: S.optional(S.String),
651
+ }).pipe(
652
+ T.Http({
653
+ method: "POST",
654
+ uri: "/namespace.cloud.iam.v1beta.TokenService/BatchRevokeRevokableToken",
655
+ code: 200,
656
+ }),
657
+ ),
658
+ ).annotate({ identifier: "BatchRevokeRevokableTokenRequest" });
659
+ case 1:
660
+ return S.suspend(() =>
661
+ S.Struct({
662
+ revokedTokenIds: __S(28, __c7, 0),
663
+ }),
664
+ ).annotate({ identifier: "BatchRevokeRevokableTokenResponse" });
665
+ }
666
+ }
667
+ function __c7(j: number): any {
668
+ switch (j) {
669
+ case 0:
670
+ return S.Array(S.String);
671
+ }
672
+ }
673
+ function __c8(j: number): any {
674
+ switch (j) {
675
+ case 0:
676
+ return S.suspend(() =>
677
+ S.Struct({
678
+ name: S.optional(S.String),
679
+ description: S.optional(S.String),
680
+ expiresAt: S.optional(S.String),
681
+ policies: S.optional(__S(37, __c9, 1)),
682
+ access: S.optional(__S(38, __c9, 2)),
683
+ scope: S.optional(S.String),
684
+ }).pipe(
685
+ T.Http({
686
+ method: "POST",
687
+ uri: "/namespace.cloud.iam.v1beta.TokenService/CreateRevokableToken",
688
+ code: 200,
689
+ }),
690
+ ),
691
+ ).annotate({ identifier: "CreateRevokableTokenRequest" });
692
+ case 1:
693
+ return S.suspend(() =>
694
+ S.Struct({
695
+ bearerToken: S.String.pipe(T.SensitiveValue({})),
696
+ token: S.optional(__S(44, __c11, 0)),
697
+ }),
698
+ ).annotate({ identifier: "CreateRevokableTokenResponse" });
699
+ }
700
+ }
701
+ function __c9(j: number): any {
702
+ switch (j) {
703
+ case 0:
704
+ return S.suspend(() =>
705
+ S.Struct({
706
+ policyType: S.optional(S.String),
707
+ value: S.optional(S.String),
708
+ }),
709
+ ).annotate({ identifier: "TenantTokenPolicy" });
710
+ case 1:
711
+ return S.Array(__S(36, __c9, 0));
712
+ case 2:
713
+ return S.suspend(() =>
714
+ S.Struct({
715
+ grants: S.optional(__S(41, __c10, 1)),
716
+ }),
717
+ ).annotate({ identifier: "AccessPolicy" });
718
+ }
719
+ }
720
+ function __c10(j: number): any {
721
+ switch (j) {
722
+ case 0:
723
+ return S.suspend(() =>
724
+ S.Struct({
725
+ resourceType: S.optional(S.String),
726
+ resourceId: S.optional(S.String),
727
+ actions: S.optional(__S(28, __c7, 0)),
728
+ }),
729
+ ).annotate({ identifier: "Permission" });
730
+ case 1:
731
+ return S.Array(__S(40, __c10, 0));
732
+ }
733
+ }
734
+ function __c11(j: number): any {
735
+ switch (j) {
736
+ case 0:
737
+ return S.suspend(() =>
738
+ S.Struct({
739
+ tokenId: S.String,
740
+ tenantId: S.String,
741
+ name: S.String,
742
+ description: S.String,
743
+ createdAt: S.optional(S.String),
744
+ expiresAt: S.optional(S.String),
745
+ revokedAt: S.optional(S.String),
746
+ revokedByActorId: S.String,
747
+ creatorActorId: S.String,
748
+ scope: S.String,
749
+ permissions: __S(41, __c10, 1),
750
+ state: S.String,
751
+ }),
752
+ ).annotate({ identifier: "RevokableToken" });
753
+ }
754
+ }
755
+ function __c12(j: number): any {
756
+ switch (j) {
757
+ case 0:
758
+ return S.suspend(() =>
759
+ S.Struct({
760
+ audience: S.optional(S.String),
761
+ }).pipe(
762
+ T.Http({
763
+ method: "POST",
764
+ uri: "/namespace.cloud.iam.v1beta.TokenService/IssueIdToken",
765
+ code: 200,
766
+ }),
767
+ ),
768
+ ).annotate({ identifier: "IssueIdTokenRequest" });
769
+ case 1:
770
+ return S.suspend(() =>
771
+ S.Struct({
772
+ idToken: S.String.pipe(T.SensitiveValue({})),
773
+ }),
774
+ ).annotate({ identifier: "IssueIdTokenResponse" });
775
+ }
776
+ }
777
+ // Schema table: entry i is schema j of builder f, made on first reach.
778
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
779
+ return (__s[i] ??= __L.at(f, j));
780
+ }