@puku-ai/sdk 4.0.3 → 4.0.4

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 (199) hide show
  1. package/README.md +24 -7
  2. package/dist/index.cjs +85 -0
  3. package/dist/vendor/_vendor/partial-json-parser/parser.cjs +225 -0
  4. package/dist/vendor/api-promise.cjs +18 -0
  5. package/dist/vendor/client.cjs +1013 -0
  6. package/dist/vendor/core/api-promise.cjs +80 -0
  7. package/dist/vendor/core/api.cjs +2 -0
  8. package/dist/vendor/core/credentials.cjs +313 -0
  9. package/dist/vendor/core/error.cjs +156 -0
  10. package/dist/vendor/core/middleware.cjs +173 -0
  11. package/dist/vendor/core/pagination.cjs +215 -0
  12. package/dist/vendor/core/resource.cjs +11 -0
  13. package/dist/vendor/core/streaming.cjs +346 -0
  14. package/dist/vendor/core/uploads.cjs +5 -0
  15. package/dist/vendor/error.cjs +18 -0
  16. package/dist/vendor/helpers/beta/environments.cjs +30 -0
  17. package/dist/vendor/helpers/beta/json-schema.cjs +56 -0
  18. package/dist/vendor/helpers/beta/mcp.cjs +418 -0
  19. package/dist/vendor/helpers/beta/memory.cjs +17 -0
  20. package/dist/vendor/helpers/beta/standard-schema.cjs +57 -0
  21. package/dist/vendor/helpers/beta/zod.cjs +88 -0
  22. package/dist/vendor/helpers/index.cjs +7 -0
  23. package/dist/vendor/helpers/json-schema.cjs +36 -0
  24. package/dist/vendor/helpers/zod.cjs +77 -0
  25. package/dist/vendor/index.cjs +54 -0
  26. package/dist/vendor/internal/builtin-types.cjs +3 -0
  27. package/dist/vendor/internal/constants.cjs +12 -0
  28. package/dist/vendor/internal/decoders/jsonl.cjs +40 -0
  29. package/dist/vendor/internal/decoders/line.cjs +109 -0
  30. package/dist/vendor/internal/detect-platform.cjs +159 -0
  31. package/dist/vendor/internal/errors.cjs +42 -0
  32. package/dist/vendor/internal/file-store.cjs +535 -0
  33. package/dist/vendor/internal/headers.cjs +119 -0
  34. package/dist/vendor/internal/message-stream-utils.cjs +33 -0
  35. package/dist/vendor/internal/node.browser.cjs +21 -0
  36. package/dist/vendor/internal/node.cjs +55 -0
  37. package/dist/vendor/internal/parse.cjs +65 -0
  38. package/dist/vendor/internal/qs/formats.cjs +12 -0
  39. package/dist/vendor/internal/qs/index.cjs +13 -0
  40. package/dist/vendor/internal/qs/stringify.cjs +276 -0
  41. package/dist/vendor/internal/qs/types.cjs +2 -0
  42. package/dist/vendor/internal/qs/utils.cjs +229 -0
  43. package/dist/vendor/internal/request-options.cjs +31 -0
  44. package/dist/vendor/internal/request-signal.cjs +49 -0
  45. package/dist/vendor/internal/shim-types.cjs +3 -0
  46. package/dist/vendor/internal/shims.cjs +91 -0
  47. package/dist/vendor/internal/stainless-helper-header.cjs +90 -0
  48. package/dist/vendor/internal/stream-utils.cjs +37 -0
  49. package/dist/vendor/internal/to-file.cjs +95 -0
  50. package/dist/vendor/internal/types.cjs +3 -0
  51. package/dist/vendor/internal/uploads.cjs +148 -0
  52. package/dist/vendor/internal/utils/abort.cjs +24 -0
  53. package/dist/vendor/internal/utils/async-queue.cjs +69 -0
  54. package/dist/vendor/internal/utils/backoff.cjs +43 -0
  55. package/dist/vendor/internal/utils/base64.cjs +37 -0
  56. package/dist/vendor/internal/utils/bytes.cjs +30 -0
  57. package/dist/vendor/internal/utils/env.cjs +21 -0
  58. package/dist/vendor/internal/utils/log.cjs +111 -0
  59. package/dist/vendor/internal/utils/path.cjs +78 -0
  60. package/dist/vendor/internal/utils/promise.cjs +17 -0
  61. package/dist/vendor/internal/utils/query.cjs +41 -0
  62. package/dist/vendor/internal/utils/sleep.cjs +27 -0
  63. package/dist/vendor/internal/utils/time.cjs +7 -0
  64. package/dist/vendor/internal/utils/uuid.cjs +18 -0
  65. package/dist/vendor/internal/utils/values.cjs +125 -0
  66. package/dist/vendor/internal/utils.cjs +24 -0
  67. package/dist/vendor/lib/BetaMessageStream.cjs +665 -0
  68. package/dist/vendor/lib/MessageStream.cjs +612 -0
  69. package/dist/vendor/lib/beta-parser.cjs +78 -0
  70. package/dist/vendor/lib/credentials/credential-chain.cjs +244 -0
  71. package/dist/vendor/lib/credentials/identity-token.cjs +71 -0
  72. package/dist/vendor/lib/credentials/oidc-federation.cjs +81 -0
  73. package/dist/vendor/lib/credentials/token-cache.cjs +113 -0
  74. package/dist/vendor/lib/credentials/types.cjs +267 -0
  75. package/dist/vendor/lib/credentials/user-oauth.cjs +129 -0
  76. package/dist/vendor/lib/credentials.cjs +7 -0
  77. package/dist/vendor/lib/environments/index.cjs +17 -0
  78. package/dist/vendor/lib/environments/poller.cjs +226 -0
  79. package/dist/vendor/lib/environments/worker.cjs +609 -0
  80. package/dist/vendor/lib/helper-client.cjs +57 -0
  81. package/dist/vendor/lib/middleware.cjs +779 -0
  82. package/dist/vendor/lib/parser.cjs +65 -0
  83. package/dist/vendor/lib/sessions/accumulate.cjs +44 -0
  84. package/dist/vendor/lib/standard-schema.cjs +44 -0
  85. package/dist/vendor/lib/tools/BetaRunnableTool.cjs +30 -0
  86. package/dist/vendor/lib/tools/BetaToolRunner.cjs +500 -0
  87. package/dist/vendor/lib/tools/CompactionControl.cjs +27 -0
  88. package/dist/vendor/lib/tools/SessionToolRunner.cjs +740 -0
  89. package/dist/vendor/lib/tools/ToolError.cjs +46 -0
  90. package/dist/vendor/lib/transform-json-schema.cjs +113 -0
  91. package/dist/vendor/pagination.cjs +18 -0
  92. package/dist/vendor/resource.cjs +18 -0
  93. package/dist/vendor/resources/beta/agents/agents.cjs +159 -0
  94. package/dist/vendor/resources/beta/agents/index.cjs +8 -0
  95. package/dist/vendor/resources/beta/agents/versions.cjs +35 -0
  96. package/dist/vendor/resources/beta/agents.cjs +18 -0
  97. package/dist/vendor/resources/beta/beta.cjs +105 -0
  98. package/dist/vendor/resources/beta/deployment-runs.cjs +54 -0
  99. package/dist/vendor/resources/beta/deployments.cjs +195 -0
  100. package/dist/vendor/resources/beta/dreams.cjs +115 -0
  101. package/dist/vendor/resources/beta/environments/environments.cjs +178 -0
  102. package/dist/vendor/resources/beta/environments/index.cjs +8 -0
  103. package/dist/vendor/resources/beta/environments/work.cjs +256 -0
  104. package/dist/vendor/resources/beta/environments.cjs +18 -0
  105. package/dist/vendor/resources/beta/files.cjs +123 -0
  106. package/dist/vendor/resources/beta/index.cjs +38 -0
  107. package/dist/vendor/resources/beta/memory-stores/index.cjs +10 -0
  108. package/dist/vendor/resources/beta/memory-stores/memories.cjs +129 -0
  109. package/dist/vendor/resources/beta/memory-stores/memory-stores.cjs +173 -0
  110. package/dist/vendor/resources/beta/memory-stores/memory-versions.cjs +80 -0
  111. package/dist/vendor/resources/beta/memory-stores.cjs +18 -0
  112. package/dist/vendor/resources/beta/messages/batches.cjs +206 -0
  113. package/dist/vendor/resources/beta/messages/index.cjs +11 -0
  114. package/dist/vendor/resources/beta/messages/messages.cjs +189 -0
  115. package/dist/vendor/resources/beta/messages.cjs +18 -0
  116. package/dist/vendor/resources/beta/models.cjs +59 -0
  117. package/dist/vendor/resources/beta/organization/api-keys.cjs +55 -0
  118. package/dist/vendor/resources/beta/organization/compliance-settings.cjs +51 -0
  119. package/dist/vendor/resources/beta/organization/external-keys.cjs +118 -0
  120. package/dist/vendor/resources/beta/organization/federation/federation.cjs +49 -0
  121. package/dist/vendor/resources/beta/organization/federation/index.cjs +10 -0
  122. package/dist/vendor/resources/beta/organization/federation/issuers.cjs +168 -0
  123. package/dist/vendor/resources/beta/organization/federation/rules/index.cjs +8 -0
  124. package/dist/vendor/resources/beta/organization/federation/rules/rules.cjs +226 -0
  125. package/dist/vendor/resources/beta/organization/federation/rules/workspaces.cjs +113 -0
  126. package/dist/vendor/resources/beta/organization/federation/rules.cjs +18 -0
  127. package/dist/vendor/resources/beta/organization/federation.cjs +18 -0
  128. package/dist/vendor/resources/beta/organization/index.cjs +24 -0
  129. package/dist/vendor/resources/beta/organization/invites.cjs +75 -0
  130. package/dist/vendor/resources/beta/organization/organization.cjs +90 -0
  131. package/dist/vendor/resources/beta/organization/rate-limits.cjs +30 -0
  132. package/dist/vendor/resources/beta/organization/service-accounts/index.cjs +8 -0
  133. package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.cjs +202 -0
  134. package/dist/vendor/resources/beta/organization/service-accounts/workspaces.cjs +124 -0
  135. package/dist/vendor/resources/beta/organization/service-accounts.cjs +18 -0
  136. package/dist/vendor/resources/beta/organization/users.cjs +66 -0
  137. package/dist/vendor/resources/beta/organization/workspaces/index.cjs +12 -0
  138. package/dist/vendor/resources/beta/organization/workspaces/members.cjs +101 -0
  139. package/dist/vendor/resources/beta/organization/workspaces/rate-limits.cjs +33 -0
  140. package/dist/vendor/resources/beta/organization/workspaces/service-accounts.cjs +188 -0
  141. package/dist/vendor/resources/beta/organization/workspaces/workspaces.cjs +140 -0
  142. package/dist/vendor/resources/beta/organization/workspaces.cjs +18 -0
  143. package/dist/vendor/resources/beta/organization.cjs +18 -0
  144. package/dist/vendor/resources/beta/sessions/events.cjs +119 -0
  145. package/dist/vendor/resources/beta/sessions/index.cjs +12 -0
  146. package/dist/vendor/resources/beta/sessions/resources.cjs +131 -0
  147. package/dist/vendor/resources/beta/sessions/sessions.cjs +186 -0
  148. package/dist/vendor/resources/beta/sessions/threads/events.cjs +60 -0
  149. package/dist/vendor/resources/beta/sessions/threads/index.cjs +8 -0
  150. package/dist/vendor/resources/beta/sessions/threads/threads.cjs +116 -0
  151. package/dist/vendor/resources/beta/sessions/threads.cjs +18 -0
  152. package/dist/vendor/resources/beta/sessions.cjs +18 -0
  153. package/dist/vendor/resources/beta/skills/index.cjs +8 -0
  154. package/dist/vendor/resources/beta/skills/skills.cjs +132 -0
  155. package/dist/vendor/resources/beta/skills/versions.cjs +128 -0
  156. package/dist/vendor/resources/beta/skills.cjs +18 -0
  157. package/dist/vendor/resources/beta/tunnels/certificates.cjs +128 -0
  158. package/dist/vendor/resources/beta/tunnels/index.cjs +8 -0
  159. package/dist/vendor/resources/beta/tunnels/tunnels.cjs +209 -0
  160. package/dist/vendor/resources/beta/tunnels.cjs +18 -0
  161. package/dist/vendor/resources/beta/user-profiles.cjs +117 -0
  162. package/dist/vendor/resources/beta/vaults/credentials.cjs +176 -0
  163. package/dist/vendor/resources/beta/vaults/index.cjs +8 -0
  164. package/dist/vendor/resources/beta/vaults/vaults.cjs +177 -0
  165. package/dist/vendor/resources/beta/vaults.cjs +18 -0
  166. package/dist/vendor/resources/beta/webhooks.cjs +32 -0
  167. package/dist/vendor/resources/beta.cjs +18 -0
  168. package/dist/vendor/resources/completions.cjs +22 -0
  169. package/dist/vendor/resources/files.cjs +51 -0
  170. package/dist/vendor/resources/index.cjs +31 -0
  171. package/dist/vendor/resources/messages/batches.cjs +160 -0
  172. package/dist/vendor/resources/messages/index.cjs +8 -0
  173. package/dist/vendor/resources/messages/messages.cjs +159 -0
  174. package/dist/vendor/resources/messages.cjs +18 -0
  175. package/dist/vendor/resources/models.cjs +44 -0
  176. package/dist/vendor/resources/shared.cjs +3 -0
  177. package/dist/vendor/resources/skills/index.cjs +8 -0
  178. package/dist/vendor/resources/skills/skills.cjs +72 -0
  179. package/dist/vendor/resources/skills/versions.cjs +40 -0
  180. package/dist/vendor/resources/skills.cjs +18 -0
  181. package/dist/vendor/resources/top-level.cjs +3 -0
  182. package/dist/vendor/resources.cjs +17 -0
  183. package/dist/vendor/streaming.cjs +18 -0
  184. package/dist/vendor/tools/agent-toolset/fs-util.cjs +193 -0
  185. package/dist/vendor/tools/agent-toolset/memories.cjs +916 -0
  186. package/dist/vendor/tools/agent-toolset/node.browser.cjs +147 -0
  187. package/dist/vendor/tools/agent-toolset/node.cjs +939 -0
  188. package/dist/vendor/tools/agent-toolset/skills.cjs +325 -0
  189. package/dist/vendor/tools/agent-toolset/sync-interval.cjs +28 -0
  190. package/dist/vendor/tools/memory/node.browser.cjs +48 -0
  191. package/dist/vendor/tools/memory/node.cjs +364 -0
  192. package/dist/vendor/uploads.cjs +18 -0
  193. package/dist/vendor/version.cjs +4 -0
  194. package/package.json +12 -13
  195. package/sdk.cjs +0 -14271
  196. package/sdk.cjs.map +0 -149
  197. package/sdk.d.ts +0 -10866
  198. package/sdk.mjs +0 -68
  199. package/sdk.mjs.map +0 -149
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ServiceAccounts = void 0;
38
+ const resource_1 = require("../../../../core/resource");
39
+ const WorkspacesAPI = __importStar(require("./workspaces"));
40
+ const workspaces_1 = require("./workspaces");
41
+ const pagination_1 = require("../../../../core/pagination");
42
+ const headers_1 = require("../../../../internal/headers");
43
+ const path_1 = require("../../../../internal/utils/path");
44
+ class ServiceAccounts extends resource_1.APIResource {
45
+ workspaces = new WorkspacesAPI.Workspaces(this._client);
46
+ /**
47
+ * **Requires an OAuth access token with the `org:admin` scope**, from
48
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
49
+ * API keys are not accepted. See
50
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
51
+ *
52
+ * Create a service account.
53
+ *
54
+ * A service account is a named workload identity that federation rules target.
55
+ * `organization_role` is `developer` (default) or `admin`; a rule may only be
56
+ * created or retargeted to grant `org:admin` scope when the target's
57
+ * `organization_role` is `admin`. Creating an `admin`-role service account
58
+ * requires an interactive credential (a user OAuth token or a Console session) — a
59
+ * workload may only create `developer`-role service accounts.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const betaServiceAccount =
64
+ * await client.beta.organization.serviceAccounts.create({
65
+ * name: 'ci-deploy-bot',
66
+ * });
67
+ * ```
68
+ */
69
+ create(params, options) {
70
+ const { betas, ...body } = params;
71
+ return this._client.post('/v1/organizations/service_accounts?beta=true', {
72
+ body,
73
+ ...options,
74
+ headers: (0, headers_1.buildHeaders)([
75
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
76
+ options?.headers,
77
+ ]),
78
+ });
79
+ }
80
+ /**
81
+ * **Requires an OAuth access token with the `org:admin` scope**, from
82
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
83
+ * API keys are not accepted. See
84
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
85
+ *
86
+ * Retrieve a service account by its ID (`svac_...`).
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const betaServiceAccount =
91
+ * await client.beta.organization.serviceAccounts.retrieve(
92
+ * 'service_account_id',
93
+ * );
94
+ * ```
95
+ */
96
+ retrieve(serviceAccountID, params = {}, options) {
97
+ const { betas } = params ?? {};
98
+ return this._client.get((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
99
+ ...options,
100
+ headers: (0, headers_1.buildHeaders)([
101
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
102
+ options?.headers,
103
+ ]),
104
+ });
105
+ }
106
+ /**
107
+ * **Requires an OAuth access token with the `org:admin` scope**, from
108
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
109
+ * API keys are not accepted. See
110
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
111
+ *
112
+ * Update a service account.
113
+ *
114
+ * Only `description` and `organization_role` are mutable; `name` cannot be
115
+ * changed. Archived service accounts cannot be updated; this returns 400. Setting
116
+ * `organization_role` to `admin` (even when unchanged) requires an interactive
117
+ * credential (a user OAuth token or a Console session).
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const betaServiceAccount =
122
+ * await client.beta.organization.serviceAccounts.update(
123
+ * 'service_account_id',
124
+ * );
125
+ * ```
126
+ */
127
+ update(serviceAccountID, params, options) {
128
+ const { betas, ...body } = params;
129
+ return this._client.post((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}?beta=true`, {
130
+ body,
131
+ ...options,
132
+ headers: (0, headers_1.buildHeaders)([
133
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
134
+ options?.headers,
135
+ ]),
136
+ });
137
+ }
138
+ /**
139
+ * **Requires an OAuth access token with the `org:admin` scope**, from
140
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
141
+ * API keys are not accepted. See
142
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
143
+ *
144
+ * List service accounts in the caller's organization.
145
+ *
146
+ * Results are ordered by creation time, newest first. Use `limit` and the
147
+ * `next_page` cursor to paginate; set `include_archived=true` to include archived
148
+ * service accounts.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * // Automatically fetches more pages as needed.
153
+ * for await (const betaServiceAccount of client.beta.organization.serviceAccounts.list()) {
154
+ * // ...
155
+ * }
156
+ * ```
157
+ */
158
+ list(params = {}, options) {
159
+ const { betas, ...query } = params ?? {};
160
+ return this._client.getAPIList('/v1/organizations/service_accounts?beta=true', (pagination_1.PageCursor), {
161
+ query,
162
+ ...options,
163
+ headers: (0, headers_1.buildHeaders)([
164
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
165
+ options?.headers,
166
+ ]),
167
+ });
168
+ }
169
+ /**
170
+ * **Requires an OAuth access token with the `org:admin` scope**, from
171
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
172
+ * API keys are not accepted. See
173
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
174
+ *
175
+ * Archive a service account.
176
+ *
177
+ * Idempotent; re-archiving returns the service account with its original
178
+ * `archived_at`. Rejected with 400 if any live (non-archived) federation rule
179
+ * still targets this service account, same as issuer archival; archive those rules
180
+ * first or change their target to another service account.
181
+ *
182
+ * @example
183
+ * ```ts
184
+ * const betaServiceAccount =
185
+ * await client.beta.organization.serviceAccounts.archive(
186
+ * 'service_account_id',
187
+ * );
188
+ * ```
189
+ */
190
+ archive(serviceAccountID, params = {}, options) {
191
+ const { betas } = params ?? {};
192
+ return this._client.post((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}/archive?beta=true`, {
193
+ ...options,
194
+ headers: (0, headers_1.buildHeaders)([
195
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
196
+ options?.headers,
197
+ ]),
198
+ });
199
+ }
200
+ }
201
+ exports.ServiceAccounts = ServiceAccounts;
202
+ ServiceAccounts.Workspaces = workspaces_1.Workspaces;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Workspaces = void 0;
5
+ const resource_1 = require("../../../../core/resource");
6
+ const pagination_1 = require("../../../../core/pagination");
7
+ const headers_1 = require("../../../../internal/headers");
8
+ const path_1 = require("../../../../internal/utils/path");
9
+ class Workspaces extends resource_1.APIResource {
10
+ /**
11
+ * **Requires an OAuth access token with the `org:admin` scope**, from
12
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
13
+ * API keys are not accepted. See
14
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
15
+ *
16
+ * List the workspaces a service account is a member of.
17
+ *
18
+ * Each entry includes the service account's `workspace_role` in that workspace.
19
+ * Use `limit` and the `next_page` cursor to paginate. When the service account has
20
+ * no explicit default-workspace membership, the implicit (`implicit: true`)
21
+ * membership is returned as the first entry on the first page; with `limit=1` the
22
+ * first page may return up to 2 entries (the implicit entry plus one explicit
23
+ * membership) so a pagination cursor can be derived. Memberships are returned only
24
+ * while the service account is active. Without a `page` cursor, an archived
25
+ * service account returns an empty list. A `page` cursor that does not match an
26
+ * active membership returns a 400 invalid-request error. A cursor stops matching
27
+ * when the membership is removed, the workspace is deleted, or the service account
28
+ * is archived. Restart pagination from the first page to recover.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // Automatically fetches more pages as needed.
33
+ * for await (const betaServiceAccountWorkspaceMember of client.beta.organization.serviceAccounts.workspaces.list(
34
+ * 'service_account_id',
35
+ * )) {
36
+ * // ...
37
+ * }
38
+ * ```
39
+ */
40
+ list(serviceAccountID, params = {}, options) {
41
+ const { betas, ...query } = params ?? {};
42
+ return this._client.getAPIList((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}/workspaces?beta=true`, (pagination_1.PageCursor), {
43
+ query,
44
+ ...options,
45
+ headers: (0, headers_1.buildHeaders)([
46
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
47
+ options?.headers,
48
+ ]),
49
+ });
50
+ }
51
+ /**
52
+ * **Requires an OAuth access token with the `org:admin` scope**, from
53
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
54
+ * API keys are not accepted. See
55
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
56
+ *
57
+ * Add a service account to a workspace with the given `workspace_role`.
58
+ *
59
+ * Mirror of `POST /workspaces/{workspace_id}/service_accounts`, addressed from the
60
+ * service-account side; both create the same membership. If the service account is
61
+ * already an explicit member of the workspace, its `workspace_role` is replaced
62
+ * with the value supplied here. Archived workspaces return 400. Archived service
63
+ * accounts cannot be added and are rejected.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const betaServiceAccountWorkspaceMember =
68
+ * await client.beta.organization.serviceAccounts.workspaces.add(
69
+ * 'service_account_id',
70
+ * {
71
+ * workspace_id: 'workspace_id',
72
+ * workspace_role: 'workspace_admin',
73
+ * },
74
+ * );
75
+ * ```
76
+ */
77
+ add(serviceAccountID, params, options) {
78
+ const { betas, ...body } = params;
79
+ return this._client.post((0, path_1.path) `/v1/organizations/service_accounts/${serviceAccountID}/workspaces?beta=true`, {
80
+ body,
81
+ ...options,
82
+ headers: (0, headers_1.buildHeaders)([
83
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
84
+ options?.headers,
85
+ ]),
86
+ });
87
+ }
88
+ /**
89
+ * **Requires an OAuth access token with the `org:admin` scope**, from
90
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
91
+ * API keys are not accepted. See
92
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
93
+ *
94
+ * Remove a service account from a workspace.
95
+ *
96
+ * Mirror of
97
+ * `DELETE /workspaces/{workspace_id}/service_accounts/{service_account_id}`,
98
+ * addressed from the service-account side. Removal is idempotent (returns 200 even
99
+ * if the membership was already removed). A DELETE against the implicit
100
+ * default-workspace membership returns 200 but is a no-op and the membership
101
+ * persists; deleting an explicit default-workspace row reverts to the implicit
102
+ * `workspace_user` membership. Archived workspaces return 400.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const workspace =
107
+ * await client.beta.organization.serviceAccounts.workspaces.remove(
108
+ * 'workspace_id',
109
+ * { service_account_id: 'service_account_id' },
110
+ * );
111
+ * ```
112
+ */
113
+ remove(workspaceID, params, options) {
114
+ const { service_account_id, betas } = params;
115
+ return this._client.delete((0, path_1.path) `/v1/organizations/service_accounts/${service_account_id}/workspaces/${workspaceID}?beta=true`, {
116
+ ...options,
117
+ headers: (0, headers_1.buildHeaders)([
118
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
119
+ options?.headers,
120
+ ]),
121
+ });
122
+ }
123
+ }
124
+ exports.Workspaces = Workspaces;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./service-accounts/index"), exports);
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Users = void 0;
5
+ const resource_1 = require("../../../core/resource");
6
+ const pagination_1 = require("../../../core/pagination");
7
+ const path_1 = require("../../../internal/utils/path");
8
+ class Users extends resource_1.APIResource {
9
+ /**
10
+ * Retrieve a member of the organization by user ID.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const betaOrganizationUser =
15
+ * await client.beta.organization.users.retrieve('user_id');
16
+ * ```
17
+ */
18
+ retrieve(userID, options) {
19
+ return this._client.get((0, path_1.path) `/v1/organizations/users/${userID}?beta=true`, options);
20
+ }
21
+ /**
22
+ * Update a member's organization role.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const betaOrganizationUser =
27
+ * await client.beta.organization.users.update('user_id', {
28
+ * role: 'user',
29
+ * });
30
+ * ```
31
+ */
32
+ update(userID, body, options) {
33
+ return this._client.post((0, path_1.path) `/v1/organizations/users/${userID}?beta=true`, { body, ...options });
34
+ }
35
+ /**
36
+ * List the organization's members.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * // Automatically fetches more pages as needed.
41
+ * for await (const betaOrganizationUser of client.beta.organization.users.list()) {
42
+ * // ...
43
+ * }
44
+ * ```
45
+ */
46
+ list(query = {}, options) {
47
+ return this._client.getAPIList('/v1/organizations/users?beta=true', (pagination_1.Page), {
48
+ query,
49
+ ...options,
50
+ });
51
+ }
52
+ /**
53
+ * Remove a member from the organization.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const user = await client.beta.organization.users.remove(
58
+ * 'user_id',
59
+ * );
60
+ * ```
61
+ */
62
+ remove(userID, options) {
63
+ return this._client.delete((0, path_1.path) `/v1/organizations/users/${userID}?beta=true`, options);
64
+ }
65
+ }
66
+ exports.Users = Users;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Workspaces = exports.ServiceAccounts = exports.RateLimits = exports.Members = void 0;
5
+ var members_1 = require("./members");
6
+ Object.defineProperty(exports, "Members", { enumerable: true, get: function () { return members_1.Members; } });
7
+ var rate_limits_1 = require("./rate-limits");
8
+ Object.defineProperty(exports, "RateLimits", { enumerable: true, get: function () { return rate_limits_1.RateLimits; } });
9
+ var service_accounts_1 = require("./service-accounts");
10
+ Object.defineProperty(exports, "ServiceAccounts", { enumerable: true, get: function () { return service_accounts_1.ServiceAccounts; } });
11
+ var workspaces_1 = require("./workspaces");
12
+ Object.defineProperty(exports, "Workspaces", { enumerable: true, get: function () { return workspaces_1.Workspaces; } });
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Members = void 0;
5
+ const resource_1 = require("../../../../core/resource");
6
+ const pagination_1 = require("../../../../core/pagination");
7
+ const path_1 = require("../../../../internal/utils/path");
8
+ class Members extends resource_1.APIResource {
9
+ /**
10
+ * Get Workspace Member
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const betaWorkspaceMember =
15
+ * await client.beta.organization.workspaces.members.retrieve(
16
+ * 'user_id',
17
+ * { workspace_id: 'workspace_id' },
18
+ * );
19
+ * ```
20
+ */
21
+ retrieve(userID, params, options) {
22
+ const { workspace_id } = params;
23
+ return this._client.get((0, path_1.path) `/v1/organizations/workspaces/${workspace_id}/members/${userID}?beta=true`, options);
24
+ }
25
+ /**
26
+ * Update Workspace Member
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const betaWorkspaceMember =
31
+ * await client.beta.organization.workspaces.members.update(
32
+ * 'user_id',
33
+ * {
34
+ * workspace_id: 'workspace_id',
35
+ * workspace_role: 'workspace_admin',
36
+ * },
37
+ * );
38
+ * ```
39
+ */
40
+ update(userID, params, options) {
41
+ const { workspace_id, ...body } = params;
42
+ return this._client.post((0, path_1.path) `/v1/organizations/workspaces/${workspace_id}/members/${userID}?beta=true`, {
43
+ body,
44
+ ...options,
45
+ });
46
+ }
47
+ /**
48
+ * List Workspace Members
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * // Automatically fetches more pages as needed.
53
+ * for await (const betaWorkspaceMember of client.beta.organization.workspaces.members.list(
54
+ * 'workspace_id',
55
+ * )) {
56
+ * // ...
57
+ * }
58
+ * ```
59
+ */
60
+ list(workspaceID, query = {}, options) {
61
+ return this._client.getAPIList((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}/members?beta=true`, (pagination_1.Page), { query, ...options });
62
+ }
63
+ /**
64
+ * Create Workspace Member
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const betaWorkspaceMember =
69
+ * await client.beta.organization.workspaces.members.add(
70
+ * 'workspace_id',
71
+ * {
72
+ * user_id: 'user_01WCz1FkmYMm4gnmykNKUu3Q',
73
+ * workspace_role: 'workspace_admin',
74
+ * },
75
+ * );
76
+ * ```
77
+ */
78
+ add(workspaceID, body, options) {
79
+ return this._client.post((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}/members?beta=true`, {
80
+ body,
81
+ ...options,
82
+ });
83
+ }
84
+ /**
85
+ * Delete Workspace Member
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const member =
90
+ * await client.beta.organization.workspaces.members.remove(
91
+ * 'user_id',
92
+ * { workspace_id: 'workspace_id' },
93
+ * );
94
+ * ```
95
+ */
96
+ remove(userID, params, options) {
97
+ const { workspace_id } = params;
98
+ return this._client.delete((0, path_1.path) `/v1/organizations/workspaces/${workspace_id}/members/${userID}?beta=true`, options);
99
+ }
100
+ }
101
+ exports.Members = Members;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RateLimits = void 0;
5
+ const resource_1 = require("../../../../core/resource");
6
+ const pagination_1 = require("../../../../core/pagination");
7
+ const path_1 = require("../../../../internal/utils/path");
8
+ class RateLimits extends resource_1.APIResource {
9
+ /**
10
+ * List rate-limit overrides configured for a workspace.
11
+ *
12
+ * Returns only the groups and limiter types that have a workspace-level override.
13
+ * Groups without overrides inherit the organization limits and are not listed; use
14
+ * `GET /v1/organizations/rate_limits` to see those.
15
+ *
16
+ * When `limit` is omitted, every matching entry is returned in a single page; when
17
+ * `limit` truncates the result, follow `next_page` to fetch the remaining entries.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * // Automatically fetches more pages as needed.
22
+ * for await (const betaWorkspaceRateLimit of client.beta.organization.workspaces.rateLimits.list(
23
+ * 'workspace_id',
24
+ * )) {
25
+ * // ...
26
+ * }
27
+ * ```
28
+ */
29
+ list(workspaceID, query = {}, options) {
30
+ return this._client.getAPIList((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}/rate_limits?beta=true`, (pagination_1.PageCursor), { query, ...options });
31
+ }
32
+ }
33
+ exports.RateLimits = RateLimits;