@cadenya/cadenya 0.121.0 → 0.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +14 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +14 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +13 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +13 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/account.d.mts +5 -4
  12. package/resources/account.d.mts.map +1 -1
  13. package/resources/account.d.ts +5 -4
  14. package/resources/account.d.ts.map +1 -1
  15. package/resources/api-keys.d.mts +258 -1
  16. package/resources/api-keys.d.mts.map +1 -1
  17. package/resources/api-keys.d.ts +258 -1
  18. package/resources/api-keys.d.ts.map +1 -1
  19. package/resources/api-keys.js +78 -2
  20. package/resources/api-keys.js.map +1 -1
  21. package/resources/api-keys.mjs +76 -1
  22. package/resources/api-keys.mjs.map +1 -1
  23. package/resources/global-api-key.d.mts +33 -0
  24. package/resources/global-api-key.d.mts.map +1 -0
  25. package/resources/global-api-key.d.ts +33 -0
  26. package/resources/global-api-key.d.ts.map +1 -0
  27. package/resources/global-api-key.js +43 -0
  28. package/resources/global-api-key.js.map +1 -0
  29. package/resources/global-api-key.mjs +39 -0
  30. package/resources/global-api-key.mjs.map +1 -0
  31. package/resources/index.d.mts +2 -1
  32. package/resources/index.d.mts.map +1 -1
  33. package/resources/index.d.ts +2 -1
  34. package/resources/index.d.ts.map +1 -1
  35. package/resources/index.js +4 -2
  36. package/resources/index.js.map +1 -1
  37. package/resources/index.mjs +2 -1
  38. package/resources/index.mjs.map +1 -1
  39. package/src/client.ts +33 -13
  40. package/src/resources/account.ts +5 -4
  41. package/src/resources/api-keys.ts +345 -1
  42. package/src/resources/global-api-key.ts +46 -0
  43. package/src/resources/index.ts +6 -1
  44. package/src/version.ts +1 -1
  45. package/version.d.mts +1 -1
  46. package/version.d.ts +1 -1
  47. package/version.js +1 -1
  48. package/version.mjs +1 -1
  49. package/resources/api-keys/access.d.mts +0 -53
  50. package/resources/api-keys/access.d.mts.map +0 -1
  51. package/resources/api-keys/access.d.ts +0 -53
  52. package/resources/api-keys/access.d.ts.map +0 -1
  53. package/resources/api-keys/access.js +0 -41
  54. package/resources/api-keys/access.js.map +0 -1
  55. package/resources/api-keys/access.mjs +0 -37
  56. package/resources/api-keys/access.mjs.map +0 -1
  57. package/resources/api-keys/api-keys.d.mts +0 -230
  58. package/resources/api-keys/api-keys.d.mts.map +0 -1
  59. package/resources/api-keys/api-keys.d.ts +0 -230
  60. package/resources/api-keys/api-keys.d.ts.map +0 -1
  61. package/resources/api-keys/api-keys.js +0 -65
  62. package/resources/api-keys/api-keys.js.map +0 -1
  63. package/resources/api-keys/api-keys.mjs +0 -60
  64. package/resources/api-keys/api-keys.mjs.map +0 -1
  65. package/resources/api-keys/index.d.mts +0 -3
  66. package/resources/api-keys/index.d.mts.map +0 -1
  67. package/resources/api-keys/index.d.ts +0 -3
  68. package/resources/api-keys/index.d.ts.map +0 -1
  69. package/resources/api-keys/index.js +0 -9
  70. package/resources/api-keys/index.js.map +0 -1
  71. package/resources/api-keys/index.mjs +0 -4
  72. package/resources/api-keys/index.mjs.map +0 -1
  73. package/src/resources/api-keys/access.ts +0 -86
  74. package/src/resources/api-keys/api-keys.ts +0 -300
  75. package/src/resources/api-keys/index.ts +0 -14
@@ -1,86 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../core/resource';
4
- import * as WorkspacesAPI from '../workspaces';
5
- import { WorkspacesCursorPagination } from '../workspaces';
6
- import * as APIKeysAPI from './api-keys';
7
- import { APIPromise } from '../../core/api-promise';
8
- import { CursorPagination, type CursorPaginationParams, PagePromise } from '../../core/pagination';
9
- import { buildHeaders } from '../../internal/headers';
10
- import { RequestOptions } from '../../internal/request-options';
11
- import { path } from '../../internal/utils/path';
12
-
13
- /**
14
- * Issue, rotate, and revoke API keys for the account, and grant or revoke
15
- * each key's access to individual workspaces.
16
- */
17
- export class Access extends APIResource {
18
- /**
19
- * Lists the workspaces this API key has access to. Cursor-paginated.
20
- */
21
- list(
22
- id: string,
23
- query: AccessListParams | null | undefined = {},
24
- options?: RequestOptions,
25
- ): PagePromise<WorkspacesCursorPagination, WorkspacesAPI.Workspace> {
26
- return this._client.getAPIList(
27
- path`/v1/account/api_keys/${id}/workspaces`,
28
- CursorPagination<WorkspacesAPI.Workspace>,
29
- { query, ...options },
30
- );
31
- }
32
-
33
- /**
34
- * Grants this API key access to the specified workspace. Idempotent — adding an
35
- * already-associated workspace is a no-op. Returns the updated API key with
36
- * refreshed workspace preview and total.
37
- */
38
- add(id: string, body: AccessAddParams, options?: RequestOptions): APIPromise<APIKeysAPI.APIKey> {
39
- return this._client.post(path`/v1/account/api_keys/${id}/workspaces`, { body, ...options });
40
- }
41
-
42
- /**
43
- * Revokes this API key's access to the specified workspace. Idempotent. A key may
44
- * have zero workspaces and remains valid.
45
- */
46
- remove(workspaceID: string, params: AccessRemoveParams, options?: RequestOptions): APIPromise<void> {
47
- const { id } = params;
48
- return this._client.delete(path`/v1/account/api_keys/${id}/workspaces/${workspaceID}`, {
49
- ...options,
50
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
51
- });
52
- }
53
- }
54
-
55
- export interface AccessListParams extends CursorPaginationParams {
56
- /**
57
- * Filters by metadata labels. Comma-separated key=value pairs, e.g.
58
- * "env=prod,team=ai". A resource matches only if every pair matches exactly (AND
59
- * semantics).
60
- */
61
- labels?: string;
62
- }
63
-
64
- export interface AccessAddParams {
65
- /**
66
- * The workspace to grant access to.
67
- */
68
- workspaceId?: string;
69
- }
70
-
71
- export interface AccessRemoveParams {
72
- /**
73
- * The API key losing workspace access (path).
74
- */
75
- id: string;
76
- }
77
-
78
- export declare namespace Access {
79
- export {
80
- type AccessListParams as AccessListParams,
81
- type AccessAddParams as AccessAddParams,
82
- type AccessRemoveParams as AccessRemoveParams,
83
- };
84
- }
85
-
86
- export { type WorkspacesCursorPagination };
@@ -1,300 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../core/resource';
4
- import * as AccountAPI from '../account';
5
- import * as Shared from '../shared';
6
- import * as AccessAPI from './access';
7
- import { Access, AccessAddParams, AccessListParams, AccessRemoveParams } from './access';
8
- import { APIPromise } from '../../core/api-promise';
9
- import { CursorPagination, type CursorPaginationParams, PagePromise } from '../../core/pagination';
10
- import { buildHeaders } from '../../internal/headers';
11
- import { RequestOptions } from '../../internal/request-options';
12
- import { path } from '../../internal/utils/path';
13
-
14
- /**
15
- * Issue, rotate, and revoke API keys for the account, and grant or revoke
16
- * each key's access to individual workspaces.
17
- */
18
- export class APIKeys extends APIResource {
19
- access: AccessAPI.Access = new AccessAPI.Access(this._client);
20
-
21
- /**
22
- * Creates a new API key on the account. Optionally grants the key access to one or
23
- * more workspaces via initial_workspace_ids.
24
- */
25
- create(body: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKey> {
26
- return this._client.post('/v1/account/api_keys', { body, ...options });
27
- }
28
-
29
- /**
30
- * Retrieves an API key by ID.
31
- */
32
- retrieve(id: string, options?: RequestOptions): APIPromise<APIKey> {
33
- return this._client.get(path`/v1/account/api_keys/${id}`, options);
34
- }
35
-
36
- /**
37
- * Updates an API key.
38
- */
39
- update(id: string, body: APIKeyUpdateParams, options?: RequestOptions): APIPromise<APIKey> {
40
- return this._client.patch(path`/v1/account/api_keys/${id}`, { body, ...options });
41
- }
42
-
43
- /**
44
- * Lists all API keys on the account.
45
- */
46
- list(
47
- query: APIKeyListParams | null | undefined = {},
48
- options?: RequestOptions,
49
- ): PagePromise<APIKeysCursorPagination, APIKey> {
50
- return this._client.getAPIList('/v1/account/api_keys', CursorPagination<APIKey>, { query, ...options });
51
- }
52
-
53
- /**
54
- * Deletes an API key.
55
- */
56
- delete(id: string, options?: RequestOptions): APIPromise<void> {
57
- return this._client.delete(path`/v1/account/api_keys/${id}`, {
58
- ...options,
59
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
60
- });
61
- }
62
-
63
- /**
64
- * Rotates an API key and returns a new token. All previous tokens for this key are
65
- * invalidated.
66
- */
67
- rotate(id: string, body: APIKeyRotateParams, options?: RequestOptions): APIPromise<APIKey> {
68
- return this._client.post(path`/v1/account/api_keys/${id}:rotate`, { body, ...options });
69
- }
70
- }
71
-
72
- export type APIKeysCursorPagination = CursorPagination<APIKey>;
73
-
74
- /**
75
- * An API key for the account. Use workspace-association RPCs to grant the key
76
- * access to specific workspaces; a key with zero workspaces is valid but cannot
77
- * access workspace-scoped resources.
78
- */
79
- export interface APIKey {
80
- /**
81
- * AccountResourceMetadata is used to represent a resource that is associated to an
82
- * account but not to a workspace.
83
- */
84
- metadata: Shared.AccountResourceMetadata;
85
-
86
- /**
87
- * Configuration for an API key.
88
- */
89
- spec: APIKeySpec;
90
-
91
- info?: APIKeyInfo;
92
- }
93
-
94
- export interface APIKeyInfo {
95
- /**
96
- * A profile identifies a user or non-human principal (such as an API key) at the
97
- * account level. Profiles are account-scoped and can be granted access to multiple
98
- * workspaces.
99
- */
100
- createdBy?: AccountAPI.Profile;
101
-
102
- /**
103
- * Up to a small number of workspaces this key has access to, intended for display
104
- * ("Workspace 1, Workspace 2, and 4 more"). Use ListAPIKeyWorkspaces for the full
105
- * paginated list.
106
- */
107
- workspacesPreview?: Array<Shared.BareMetadata>;
108
-
109
- /**
110
- * Total number of workspaces this key has access to.
111
- */
112
- workspacesTotal?: number;
113
- }
114
-
115
- /**
116
- * Configuration for an API key.
117
- */
118
- export interface APIKeySpec {
119
- /**
120
- * The bearer token used to authenticate as this API key. Returned only on creation
121
- * and rotation; subsequent reads omit this field.
122
- */
123
- token?: string;
124
-
125
- /**
126
- * Free-form description of what this API key is used for.
127
- */
128
- description?: string;
129
-
130
- /**
131
- * Scopes granted to this key. Each entry is a colon-separated resource:verb string
132
- * (e.g. "objectives:manage").
133
- *
134
- * Resources: agents, objectives, tools, memory, api_keys, workspaces, secrets,
135
- * account. Verbs: read and manage, where manage implies read — a stored scope set
136
- * is normalized to drop "x:read" when "x:manage" is present. The secrets and
137
- * account resources support only manage. "\*" is an explicit full-access grant.
138
- *
139
- * Scopes are deny-by-default: a key with an empty list can call only scope-free
140
- * endpoints. Full access is always an explicit "\*" grant.
141
- */
142
- permissions?: Array<string>;
143
-
144
- /**
145
- * True when this key is managed by the system (e.g. the auto-provisioned global
146
- * account key). System keys cannot be deleted but can be rotated.
147
- */
148
- system?: boolean;
149
- }
150
-
151
- export interface APIKeyCreateParams {
152
- /**
153
- * CreateAccountResourceMetadata contains the user-provided fields for creating an
154
- * account-scoped resource. Read-only fields (id, account_id, profile_id) are
155
- * excluded since they are set by the server.
156
- */
157
- metadata: APIKeyCreateParams.Metadata;
158
-
159
- /**
160
- * Configuration for an API key.
161
- */
162
- spec: APIKeySpec;
163
-
164
- /**
165
- * Workspaces this API key will have access to on creation. Optional — a key can be
166
- * created with no workspace access and granted later via AddAPIKeyWorkspace.
167
- */
168
- initialWorkspaceIds?: Array<string>;
169
- }
170
-
171
- export namespace APIKeyCreateParams {
172
- /**
173
- * CreateAccountResourceMetadata contains the user-provided fields for creating an
174
- * account-scoped resource. Read-only fields (id, account_id, profile_id) are
175
- * excluded since they are set by the server.
176
- */
177
- export interface Metadata {
178
- /**
179
- * Human-readable name for the resource (e.g., "Production API Key", "Staging
180
- * Workspace")
181
- */
182
- name: string;
183
-
184
- /**
185
- * External ID for the resource (e.g., a workflow ID from an external system)
186
- */
187
- externalId?: string;
188
-
189
- /**
190
- * Key-value pairs for categorization and filtering. Values are 0-63 alphanumeric
191
- * characters with "-", "\_", or "." allowed between; keys follow the same shape
192
- * and additionally accept an optional DNS-subdomain prefix (e.g. "cadenya.com/")
193
- * of at most 253 characters. Examples: {"environment": "production", "team":
194
- * "platform", "version": "v2"}
195
- */
196
- labels?: { [key: string]: string };
197
- }
198
- }
199
-
200
- export interface APIKeyUpdateParams {
201
- /**
202
- * UpdateAccountResourceMetadata contains the user-provided fields for updating an
203
- * account-scoped resource. Read-only fields (id, account_id, profile_id) are
204
- * excluded since they are set by the server.
205
- */
206
- metadata?: APIKeyUpdateParams.Metadata;
207
-
208
- /**
209
- * Configuration for an API key.
210
- */
211
- spec?: APIKeySpec;
212
-
213
- /**
214
- * Fields to update.
215
- */
216
- updateMask?: string;
217
- }
218
-
219
- export namespace APIKeyUpdateParams {
220
- /**
221
- * UpdateAccountResourceMetadata contains the user-provided fields for updating an
222
- * account-scoped resource. Read-only fields (id, account_id, profile_id) are
223
- * excluded since they are set by the server.
224
- */
225
- export interface Metadata {
226
- /**
227
- * Human-readable name for the resource (e.g., "Production API Key", "Staging
228
- * Workspace")
229
- */
230
- name: string;
231
-
232
- /**
233
- * External ID for the resource (e.g., a workflow ID from an external system)
234
- */
235
- externalId?: string;
236
-
237
- /**
238
- * Key-value pairs for categorization and filtering. Values are 0-63 alphanumeric
239
- * characters with "-", "\_", or "." allowed between; keys follow the same shape
240
- * and additionally accept an optional DNS-subdomain prefix (e.g. "cadenya.com/")
241
- * of at most 253 characters. Examples: {"environment": "production", "team":
242
- * "platform", "version": "v2"}
243
- */
244
- labels?: { [key: string]: string };
245
- }
246
- }
247
-
248
- export interface APIKeyListParams extends CursorPaginationParams {
249
- /**
250
- * When true, included info fields are populated. Requests with this flag count
251
- * more against your rate limit.
252
- */
253
- includeInfo?: boolean;
254
-
255
- /**
256
- * Filters by metadata labels. Comma-separated key=value pairs, e.g.
257
- * "env=prod,team=ai". A resource matches only if every pair matches exactly (AND
258
- * semantics).
259
- */
260
- labels?: string;
261
-
262
- /**
263
- * Filter by ID prefix.
264
- */
265
- prefix?: string;
266
-
267
- /**
268
- * Free-form search query.
269
- */
270
- query?: string;
271
-
272
- /**
273
- * Sort order for results (asc or desc by creation time).
274
- */
275
- sortOrder?: string;
276
- }
277
-
278
- export interface APIKeyRotateParams {}
279
-
280
- APIKeys.Access = Access;
281
-
282
- export declare namespace APIKeys {
283
- export {
284
- type APIKey as APIKey,
285
- type APIKeyInfo as APIKeyInfo,
286
- type APIKeySpec as APIKeySpec,
287
- type APIKeysCursorPagination as APIKeysCursorPagination,
288
- type APIKeyCreateParams as APIKeyCreateParams,
289
- type APIKeyUpdateParams as APIKeyUpdateParams,
290
- type APIKeyListParams as APIKeyListParams,
291
- type APIKeyRotateParams as APIKeyRotateParams,
292
- };
293
-
294
- export {
295
- Access as Access,
296
- type AccessListParams as AccessListParams,
297
- type AccessAddParams as AccessAddParams,
298
- type AccessRemoveParams as AccessRemoveParams,
299
- };
300
- }
@@ -1,14 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export {
4
- APIKeys,
5
- type APIKey,
6
- type APIKeyInfo,
7
- type APIKeySpec,
8
- type APIKeyCreateParams,
9
- type APIKeyUpdateParams,
10
- type APIKeyListParams,
11
- type APIKeyRotateParams,
12
- type APIKeysCursorPagination,
13
- } from './api-keys';
14
- export { Access, type AccessListParams, type AccessAddParams, type AccessRemoveParams } from './access';