@cadenya/cadenya 0.68.0 → 0.70.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 (68) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client.d.mts +6 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/account.d.mts +17 -12
  12. package/resources/account.d.mts.map +1 -1
  13. package/resources/account.d.ts +17 -12
  14. package/resources/account.d.ts.map +1 -1
  15. package/resources/account.js.map +1 -1
  16. package/resources/account.mjs.map +1 -1
  17. package/resources/api-keys/access.d.mts +47 -0
  18. package/resources/api-keys/access.d.mts.map +1 -0
  19. package/resources/api-keys/access.d.ts +47 -0
  20. package/resources/api-keys/access.d.ts.map +1 -0
  21. package/resources/api-keys/access.js +41 -0
  22. package/resources/api-keys/access.js.map +1 -0
  23. package/resources/api-keys/access.mjs +37 -0
  24. package/resources/api-keys/access.mjs.map +1 -0
  25. package/resources/api-keys/api-keys.d.mts +213 -0
  26. package/resources/api-keys/api-keys.d.mts.map +1 -0
  27. package/resources/api-keys/api-keys.d.ts +213 -0
  28. package/resources/api-keys/api-keys.d.ts.map +1 -0
  29. package/resources/api-keys/api-keys.js +65 -0
  30. package/resources/api-keys/api-keys.js.map +1 -0
  31. package/resources/api-keys/api-keys.mjs +60 -0
  32. package/resources/api-keys/api-keys.mjs.map +1 -0
  33. package/resources/api-keys/index.d.mts +3 -0
  34. package/resources/api-keys/index.d.mts.map +1 -0
  35. package/resources/api-keys/index.d.ts +3 -0
  36. package/resources/api-keys/index.d.ts.map +1 -0
  37. package/resources/api-keys/index.js +9 -0
  38. package/resources/api-keys/index.js.map +1 -0
  39. package/resources/api-keys/index.mjs +4 -0
  40. package/resources/api-keys/index.mjs.map +1 -0
  41. package/resources/api-keys.d.mts +1 -151
  42. package/resources/api-keys.d.mts.map +1 -1
  43. package/resources/api-keys.d.ts +1 -151
  44. package/resources/api-keys.d.ts.map +1 -1
  45. package/resources/api-keys.js +2 -59
  46. package/resources/api-keys.js.map +1 -1
  47. package/resources/api-keys.mjs +1 -57
  48. package/resources/api-keys.mjs.map +1 -1
  49. package/resources/index.d.mts +2 -2
  50. package/resources/index.d.mts.map +1 -1
  51. package/resources/index.d.ts +2 -2
  52. package/resources/index.d.ts.map +1 -1
  53. package/resources/index.js +1 -1
  54. package/resources/index.js.map +1 -1
  55. package/resources/index.mjs +1 -1
  56. package/resources/index.mjs.map +1 -1
  57. package/src/client.ts +14 -18
  58. package/src/resources/account.ts +18 -11
  59. package/src/resources/api-keys/access.ts +79 -0
  60. package/src/resources/api-keys/api-keys.ts +282 -0
  61. package/src/resources/api-keys/index.ts +13 -0
  62. package/src/resources/api-keys.ts +1 -218
  63. package/src/resources/index.ts +2 -4
  64. package/src/version.ts +1 -1
  65. package/version.d.mts +1 -1
  66. package/version.d.ts +1 -1
  67. package/version.js +1 -1
  68. package/version.mjs +1 -1
@@ -0,0 +1,282 @@
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, options?: RequestOptions): APIPromise<APIKey> {
68
+ return this._client.put(path`/v1/account/api_keys/${id}/rotate`, 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
+ * Permissions granted to this key. Each entry is a colon-separated verb:resource
132
+ * string (e.g. "manage:agents"). Currently has no enforced effect; reserved for
133
+ * future fine-grained authorization.
134
+ */
135
+ permissions?: Array<string>;
136
+
137
+ /**
138
+ * True when this key is managed by the system (e.g. the auto-provisioned global
139
+ * account key). System keys cannot be deleted but can be rotated.
140
+ */
141
+ system?: boolean;
142
+ }
143
+
144
+ export interface APIKeyCreateParams {
145
+ /**
146
+ * CreateAccountResourceMetadata contains the user-provided fields for creating an
147
+ * account-scoped resource. Read-only fields (id, account_id, profile_id) are
148
+ * excluded since they are set by the server.
149
+ */
150
+ metadata: APIKeyCreateParams.Metadata;
151
+
152
+ /**
153
+ * Configuration for an API key.
154
+ */
155
+ spec: APIKeySpec;
156
+
157
+ /**
158
+ * Workspaces this API key will have access to on creation. Optional — a key can be
159
+ * created with no workspace access and granted later via AddAPIKeyWorkspace.
160
+ */
161
+ initialWorkspaceIds?: Array<string>;
162
+ }
163
+
164
+ export namespace APIKeyCreateParams {
165
+ /**
166
+ * CreateAccountResourceMetadata contains the user-provided fields for creating an
167
+ * account-scoped resource. Read-only fields (id, account_id, profile_id) are
168
+ * excluded since they are set by the server.
169
+ */
170
+ export interface Metadata {
171
+ /**
172
+ * Human-readable name for the resource (e.g., "Production API Key", "Staging
173
+ * Workspace")
174
+ */
175
+ name: string;
176
+
177
+ /**
178
+ * External ID for the resource (e.g., a workflow ID from an external system)
179
+ */
180
+ externalId?: string;
181
+
182
+ /**
183
+ * Arbitrary key-value pairs for categorization and filtering Examples:
184
+ * {"environment": "production", "team": "platform", "version": "v2"}
185
+ */
186
+ labels?: { [key: string]: string };
187
+ }
188
+ }
189
+
190
+ export interface APIKeyUpdateParams {
191
+ /**
192
+ * UpdateAccountResourceMetadata contains the user-provided fields for updating an
193
+ * account-scoped resource. Read-only fields (id, account_id, profile_id) are
194
+ * excluded since they are set by the server.
195
+ */
196
+ metadata?: APIKeyUpdateParams.Metadata;
197
+
198
+ /**
199
+ * Configuration for an API key.
200
+ */
201
+ spec?: APIKeySpec;
202
+
203
+ /**
204
+ * Fields to update.
205
+ */
206
+ updateMask?: string;
207
+ }
208
+
209
+ export namespace APIKeyUpdateParams {
210
+ /**
211
+ * UpdateAccountResourceMetadata contains the user-provided fields for updating an
212
+ * account-scoped resource. Read-only fields (id, account_id, profile_id) are
213
+ * excluded since they are set by the server.
214
+ */
215
+ export interface Metadata {
216
+ /**
217
+ * Human-readable name for the resource (e.g., "Production API Key", "Staging
218
+ * Workspace")
219
+ */
220
+ name: string;
221
+
222
+ /**
223
+ * External ID for the resource (e.g., a workflow ID from an external system)
224
+ */
225
+ externalId?: string;
226
+
227
+ /**
228
+ * Arbitrary key-value pairs for categorization and filtering Examples:
229
+ * {"environment": "production", "team": "platform", "version": "v2"}
230
+ */
231
+ labels?: { [key: string]: string };
232
+ }
233
+ }
234
+
235
+ export interface APIKeyListParams extends CursorPaginationParams {
236
+ /**
237
+ * Filter by bundle_key — return only resources owned by this bundle.
238
+ */
239
+ bundleKey?: string;
240
+
241
+ /**
242
+ * When true, included info fields are populated. Requests with this flag count
243
+ * more against your rate limit.
244
+ */
245
+ includeInfo?: boolean;
246
+
247
+ /**
248
+ * Filter by ID prefix.
249
+ */
250
+ prefix?: string;
251
+
252
+ /**
253
+ * Free-form search query.
254
+ */
255
+ query?: string;
256
+
257
+ /**
258
+ * Sort order for results (asc or desc by creation time).
259
+ */
260
+ sortOrder?: string;
261
+ }
262
+
263
+ APIKeys.Access = Access;
264
+
265
+ export declare namespace APIKeys {
266
+ export {
267
+ type APIKey as APIKey,
268
+ type APIKeyInfo as APIKeyInfo,
269
+ type APIKeySpec as APIKeySpec,
270
+ type APIKeysCursorPagination as APIKeysCursorPagination,
271
+ type APIKeyCreateParams as APIKeyCreateParams,
272
+ type APIKeyUpdateParams as APIKeyUpdateParams,
273
+ type APIKeyListParams as APIKeyListParams,
274
+ };
275
+
276
+ export {
277
+ Access as Access,
278
+ type AccessListParams as AccessListParams,
279
+ type AccessAddParams as AccessAddParams,
280
+ type AccessRemoveParams as AccessRemoveParams,
281
+ };
282
+ }
@@ -0,0 +1,13 @@
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 APIKeysCursorPagination,
12
+ } from './api-keys';
13
+ export { Access, type AccessListParams, type AccessAddParams, type AccessRemoveParams } from './access';
@@ -1,220 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../core/resource';
4
- import * as AccountAPI from './account';
5
- import * as Shared from './shared';
6
- import { APIPromise } from '../core/api-promise';
7
- import { CursorPagination, type CursorPaginationParams, PagePromise } from '../core/pagination';
8
- import { buildHeaders } from '../internal/headers';
9
- import { RequestOptions } from '../internal/request-options';
10
- import { path } from '../internal/utils/path';
11
-
12
- /**
13
- * Issue, rotate, and revoke API keys for a workspace. Each API key belongs to
14
- * exactly one workspace, ensuring isolation between environments.
15
- */
16
- export class APIKeys extends APIResource {
17
- /**
18
- * Creates a new API key in the workspace.
19
- */
20
- create(workspaceID: string, body: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKey> {
21
- return this._client.post(path`/v1/workspaces/${workspaceID}/api_keys`, { body, ...options });
22
- }
23
-
24
- /**
25
- * Retrieves an API key by ID from the workspace
26
- */
27
- retrieve(id: string, params: APIKeyRetrieveParams, options?: RequestOptions): APIPromise<APIKey> {
28
- const { workspaceId } = params;
29
- return this._client.get(path`/v1/workspaces/${workspaceId}/api_keys/${id}`, options);
30
- }
31
-
32
- /**
33
- * Updates an API key in the workspace
34
- */
35
- update(id: string, params: APIKeyUpdateParams, options?: RequestOptions): APIPromise<APIKey> {
36
- const { workspaceId, ...body } = params;
37
- return this._client.patch(path`/v1/workspaces/${workspaceId}/api_keys/${id}`, { body, ...options });
38
- }
39
-
40
- /**
41
- * Lists all API keys in the workspace
42
- */
43
- list(
44
- workspaceID: string,
45
- query: APIKeyListParams | null | undefined = {},
46
- options?: RequestOptions,
47
- ): PagePromise<APIKeysCursorPagination, APIKey> {
48
- return this._client.getAPIList(path`/v1/workspaces/${workspaceID}/api_keys`, CursorPagination<APIKey>, {
49
- query,
50
- ...options,
51
- });
52
- }
53
-
54
- /**
55
- * Deletes an API key from the workspace
56
- */
57
- delete(id: string, params: APIKeyDeleteParams, options?: RequestOptions): APIPromise<void> {
58
- const { workspaceId } = params;
59
- return this._client.delete(path`/v1/workspaces/${workspaceId}/api_keys/${id}`, {
60
- ...options,
61
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
62
- });
63
- }
64
-
65
- /**
66
- * Rotates an API Key and returns a new token. All previous API Key tokens in use
67
- * will be invalidated.
68
- */
69
- rotate(id: string, params: APIKeyRotateParams, options?: RequestOptions): APIPromise<APIKey> {
70
- const { workspaceId } = params;
71
- return this._client.put(path`/v1/workspaces/${workspaceId}/api_keys/${id}/rotate`, options);
72
- }
73
- }
74
-
75
- export type APIKeysCursorPagination = CursorPagination<APIKey>;
76
-
77
- /**
78
- * An API key scoped to a single workspace. The key's token is used to authenticate
79
- * requests against that workspace's resources.
80
- */
81
- export interface APIKey {
82
- /**
83
- * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
84
- */
85
- metadata: Shared.ResourceMetadata;
86
-
87
- /**
88
- * Configuration for an API key.
89
- */
90
- spec: APIKeySpec;
91
-
92
- info?: APIKeyInfo;
93
- }
94
-
95
- export interface APIKeyInfo {
96
- /**
97
- * A profile identifies a user or non-human principal (such as an API key) at the
98
- * account level. Profiles are account-scoped and can be granted access to multiple
99
- * workspaces.
100
- */
101
- createdBy?: AccountAPI.Profile;
102
- }
103
-
104
- /**
105
- * Configuration for an API key.
106
- */
107
- export interface APIKeySpec {
108
- /**
109
- * The bearer token used to authenticate as this API key. Returned only on creation
110
- * and rotation; subsequent reads omit this field.
111
- */
112
- token?: string;
113
-
114
- /**
115
- * Free-form description of what this API key is used for.
116
- */
117
- description?: string;
118
- }
119
-
120
- export interface APIKeyCreateParams {
121
- /**
122
- * CreateResourceMetadata contains the user-provided fields for creating a
123
- * workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
124
- * profile_id, created_at) are excluded since they are set by the server.
125
- */
126
- metadata: Shared.CreateResourceMetadata;
127
-
128
- /**
129
- * Configuration for an API key.
130
- */
131
- spec: APIKeySpec;
132
- }
133
-
134
- export interface APIKeyRetrieveParams {
135
- /**
136
- * The workspace the API key belongs to.
137
- */
138
- workspaceId: string;
139
- }
140
-
141
- export interface APIKeyUpdateParams {
142
- /**
143
- * Path param: The workspace the API key belongs to.
144
- */
145
- workspaceId: string;
146
-
147
- /**
148
- * Body param: UpdateResourceMetadata contains the user-provided fields for
149
- * updating a workspace-scoped resource. Read-only fields (id, account_id,
150
- * workspace_id, profile_id, created_at) are excluded since they are set by the
151
- * server.
152
- */
153
- metadata?: Shared.UpdateResourceMetadata;
154
-
155
- /**
156
- * Body param: Configuration for an API key.
157
- */
158
- spec?: APIKeySpec;
159
-
160
- /**
161
- * Body param: Fields to update.
162
- */
163
- updateMask?: string;
164
- }
165
-
166
- export interface APIKeyListParams extends CursorPaginationParams {
167
- /**
168
- * Filter by bundle_key — return only resources owned by this bundle.
169
- */
170
- bundleKey?: string;
171
-
172
- /**
173
- * When set to true you may use more of your alloted API rate-limit
174
- */
175
- includeInfo?: boolean;
176
-
177
- /**
178
- * Filter expression (query param: prefix)
179
- */
180
- prefix?: string;
181
-
182
- /**
183
- * Free-form search query
184
- */
185
- query?: string;
186
-
187
- /**
188
- * Sort order for results (asc or desc by creation time)
189
- */
190
- sortOrder?: string;
191
- }
192
-
193
- export interface APIKeyDeleteParams {
194
- /**
195
- * The workspace the API key belongs to.
196
- */
197
- workspaceId: string;
198
- }
199
-
200
- export interface APIKeyRotateParams {
201
- /**
202
- * The workspace the API key belongs to.
203
- */
204
- workspaceId: string;
205
- }
206
-
207
- export declare namespace APIKeys {
208
- export {
209
- type APIKey as APIKey,
210
- type APIKeyInfo as APIKeyInfo,
211
- type APIKeySpec as APIKeySpec,
212
- type APIKeysCursorPagination as APIKeysCursorPagination,
213
- type APIKeyCreateParams as APIKeyCreateParams,
214
- type APIKeyRetrieveParams as APIKeyRetrieveParams,
215
- type APIKeyUpdateParams as APIKeyUpdateParams,
216
- type APIKeyListParams as APIKeyListParams,
217
- type APIKeyDeleteParams as APIKeyDeleteParams,
218
- type APIKeyRotateParams as APIKeyRotateParams,
219
- };
220
- }
3
+ export * from './api-keys/index';
@@ -7,16 +7,14 @@ export {
7
7
  type APIKeyInfo,
8
8
  type APIKeySpec,
9
9
  type APIKeyCreateParams,
10
- type APIKeyRetrieveParams,
11
10
  type APIKeyUpdateParams,
12
11
  type APIKeyListParams,
13
- type APIKeyDeleteParams,
14
- type APIKeyRotateParams,
15
12
  type APIKeysCursorPagination,
16
- } from './api-keys';
13
+ } from './api-keys/api-keys';
17
14
  export {
18
15
  AccountResource,
19
16
  type Account,
17
+ type AccountInfo,
20
18
  type AccountSpec,
21
19
  type Profile,
22
20
  type ProfileSpec,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.68.0'; // x-release-please-version
1
+ export const VERSION = '0.70.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.68.0";
1
+ export declare const VERSION = "0.70.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.68.0";
1
+ export declare const VERSION = "0.70.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.68.0'; // x-release-please-version
4
+ exports.VERSION = '0.70.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.68.0'; // x-release-please-version
1
+ export const VERSION = '0.70.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map