@cadenya/cadenya 0.130.0 → 0.132.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 +9 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +9 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +9 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +9 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +1 -0
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +1 -0
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +3 -1
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +1 -0
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/objectives/objectives.d.mts +18 -0
  20. package/resources/objectives/objectives.d.mts.map +1 -1
  21. package/resources/objectives/objectives.d.ts +18 -0
  22. package/resources/objectives/objectives.d.ts.map +1 -1
  23. package/resources/objectives/objectives.js.map +1 -1
  24. package/resources/objectives/objectives.mjs.map +1 -1
  25. package/resources/tenants/index.d.mts +3 -0
  26. package/resources/tenants/index.d.mts.map +1 -0
  27. package/resources/tenants/index.d.ts +3 -0
  28. package/resources/tenants/index.d.ts.map +1 -0
  29. package/resources/tenants/index.js +9 -0
  30. package/resources/tenants/index.js.map +1 -0
  31. package/resources/tenants/index.mjs +4 -0
  32. package/resources/tenants/index.mjs.map +1 -0
  33. package/resources/tenants/subjects.d.mts +43 -0
  34. package/resources/tenants/subjects.d.mts.map +1 -0
  35. package/resources/tenants/subjects.d.ts +43 -0
  36. package/resources/tenants/subjects.d.ts.map +1 -0
  37. package/resources/tenants/subjects.js +27 -0
  38. package/resources/tenants/subjects.js.map +1 -0
  39. package/resources/tenants/subjects.mjs +23 -0
  40. package/resources/tenants/subjects.mjs.map +1 -0
  41. package/resources/tenants/tenants.d.mts +158 -0
  42. package/resources/tenants/tenants.d.mts.map +1 -0
  43. package/resources/tenants/tenants.d.ts +158 -0
  44. package/resources/tenants/tenants.d.ts.map +1 -0
  45. package/resources/tenants/tenants.js +58 -0
  46. package/resources/tenants/tenants.js.map +1 -0
  47. package/resources/tenants/tenants.mjs +53 -0
  48. package/resources/tenants/tenants.mjs.map +1 -0
  49. package/resources/tenants.d.mts +2 -0
  50. package/resources/tenants.d.mts.map +1 -0
  51. package/resources/tenants.d.ts +2 -0
  52. package/resources/tenants.d.ts.map +1 -0
  53. package/resources/tenants.js +6 -0
  54. package/resources/tenants.js.map +1 -0
  55. package/resources/tenants.mjs +3 -0
  56. package/resources/tenants.mjs.map +1 -0
  57. package/src/client.ts +31 -0
  58. package/src/resources/index.ts +12 -0
  59. package/src/resources/objectives/objectives.ts +21 -0
  60. package/src/resources/tenants/index.ts +15 -0
  61. package/src/resources/tenants/subjects.ts +63 -0
  62. package/src/resources/tenants/tenants.ts +220 -0
  63. package/src/resources/tenants.ts +3 -0
  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,63 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as TenantsAPI from './tenants';
5
+ import { SubjectsCursorPagination } from './tenants';
6
+ import { CursorPagination, type CursorPaginationParams, PagePromise } from '../../core/pagination';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { path } from '../../internal/utils/path';
9
+
10
+ /**
11
+ * Read and erase tenants and the subjects under them. Tenants and subjects are
12
+ * created by assertion — on objective creation or widget session mint — never
13
+ * directly, so this service has no create or update: it exists to enumerate what
14
+ * assertions have produced, and to destroy it on request.
15
+ */
16
+ export class Subjects extends APIResource {
17
+ /**
18
+ * Lists the subjects asserted under a tenant. Subjects are only listable through
19
+ * their tenant: a subject's external_id is unique within its tenant, not across
20
+ * the workspace, so the same key can name different people under different
21
+ * tenants.
22
+ */
23
+ list(
24
+ tenantID: string,
25
+ params: SubjectListParams | null | undefined = {},
26
+ options?: RequestOptions,
27
+ ): PagePromise<SubjectsCursorPagination, TenantsAPI.Subject> {
28
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
29
+ return this._client.getAPIList(
30
+ path`/v1/workspaces/${workspaceId}/tenants/${tenantID}/subjects`,
31
+ CursorPagination<TenantsAPI.Subject>,
32
+ { query, ...options },
33
+ );
34
+ }
35
+ }
36
+
37
+ export interface SubjectListParams extends CursorPaginationParams {
38
+ /**
39
+ * Path param: Workspace ID.
40
+ */
41
+ workspaceId?: string;
42
+
43
+ /**
44
+ * Query param: When true, the `info` field on each returned subject is populated.
45
+ */
46
+ includeInfo?: boolean;
47
+
48
+ /**
49
+ * Query param: Substring match against the subject's name and external_id.
50
+ */
51
+ query?: string;
52
+
53
+ /**
54
+ * Query param: Sort order for results (asc or desc by creation time).
55
+ */
56
+ sortOrder?: string;
57
+ }
58
+
59
+ export declare namespace Subjects {
60
+ export { type SubjectListParams as SubjectListParams };
61
+ }
62
+
63
+ export { type SubjectsCursorPagination };
@@ -0,0 +1,220 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as Shared from '../shared';
5
+ import * as WidgetSessionsAPI from '../widget-sessions';
6
+ import * as SubjectsAPI from './subjects';
7
+ import { SubjectListParams, Subjects } from './subjects';
8
+ import { APIPromise } from '../../core/api-promise';
9
+ import { CursorPagination, type CursorPaginationParams, PagePromise } from '../../core/pagination';
10
+ import { RequestOptions } from '../../internal/request-options';
11
+ import { path } from '../../internal/utils/path';
12
+
13
+ /**
14
+ * Read and erase tenants and the subjects under them. Tenants and subjects are
15
+ * created by assertion — on objective creation or widget session mint — never
16
+ * directly, so this service has no create or update: it exists to enumerate what
17
+ * assertions have produced, and to destroy it on request.
18
+ */
19
+ export class Tenants extends APIResource {
20
+ subjects: SubjectsAPI.Subjects = new SubjectsAPI.Subjects(this._client);
21
+
22
+ /**
23
+ * Retrieves a tenant by its canonical id or by the `external_id:<value>` form the
24
+ * customer asserted it under.
25
+ */
26
+ retrieve(
27
+ id: string,
28
+ params: TenantRetrieveParams | null | undefined = {},
29
+ options?: RequestOptions,
30
+ ): APIPromise<Tenant> {
31
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
32
+ return this._client.get(path`/v1/workspaces/${workspaceId}/tenants/${id}`, { query, ...options });
33
+ }
34
+
35
+ /**
36
+ * Lists the tenants asserted in a workspace, newest first. `query` matches against
37
+ * a tenant's name and its external_id, for type-ahead filters.
38
+ */
39
+ list(
40
+ params: TenantListParams | null | undefined = {},
41
+ options?: RequestOptions,
42
+ ): PagePromise<TenantsCursorPagination, Tenant> {
43
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
44
+ return this._client.getAPIList(path`/v1/workspaces/${workspaceId}/tenants`, CursorPagination<Tenant>, {
45
+ query,
46
+ ...options,
47
+ });
48
+ }
49
+
50
+ /**
51
+ * Destroys the tenant, its subjects, every objective associated with it and
52
+ * everything reachable from those objectives, and its widget sessions. This is the
53
+ * full erasure hammer, wider than `DELETE /widget_sessions`, which removes only
54
+ * what widget sessions created. The work runs in the background: this returns the
55
+ * tenant in STATE_ERASING rather than a count of what was removed, since a large
56
+ * tenant's history cannot be destroyed inside a request. Poll the tenant to follow
57
+ * it — STATE_ERASING while it runs, NotFound once it finishes. Erasure is
58
+ * terminal; a tenant cannot be recovered once it starts.
59
+ */
60
+ delete(
61
+ id: string,
62
+ params: TenantDeleteParams | null | undefined = {},
63
+ options?: RequestOptions,
64
+ ): APIPromise<Tenant> {
65
+ const { workspaceId = this._client.workspaceID } = params ?? {};
66
+ return this._client.delete(path`/v1/workspaces/${workspaceId}/tenants/${id}`, options);
67
+ }
68
+ }
69
+
70
+ export type TenantsCursorPagination = CursorPagination<Tenant>;
71
+
72
+ export type SubjectsCursorPagination = CursorPagination<Subject>;
73
+
74
+ /**
75
+ * Subject is a person within a tenant as a readable record. Like Tenant it carries
76
+ * no spec — `metadata.external_id` is the customer's key for them, unique within
77
+ * the tenant rather than the workspace.
78
+ */
79
+ export interface Subject {
80
+ /**
81
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
82
+ */
83
+ metadata: Shared.ResourceMetadata;
84
+
85
+ /**
86
+ * SubjectInfo provides read-only server-derived data about a subject.
87
+ */
88
+ info?: SubjectInfo;
89
+ }
90
+
91
+ /**
92
+ * SubjectInfo provides read-only server-derived data about a subject.
93
+ */
94
+ export interface SubjectInfo {
95
+ /**
96
+ * Number of objectives associated with this subject.
97
+ */
98
+ objectiveCount?: number;
99
+
100
+ /**
101
+ * TenantReference is the read-only echo of a resource's tenant association,
102
+ * carrying both Cadenya's canonical id and the customer's own key.
103
+ */
104
+ tenant?: WidgetSessionsAPI.TenantReference;
105
+ }
106
+
107
+ /**
108
+ * Tenant is the customer's organization as a readable record rather than an echo.
109
+ * It carries no spec: a tenant is never configured, only asserted, so everything
110
+ * about it lives in the metadata envelope — `external_id` is the key the customer
111
+ * asserted it under, `name` is the most recent name they asserted, and
112
+ * `updated_at` is therefore when the tenant was last asserted.
113
+ */
114
+ export interface Tenant {
115
+ /**
116
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
117
+ */
118
+ metadata: Shared.ResourceMetadata;
119
+
120
+ /**
121
+ * The current lifecycle state of the tenant. Output only.
122
+ */
123
+ state: 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ERASING';
124
+
125
+ /**
126
+ * TenantInfo provides read-only server-derived data about a tenant.
127
+ */
128
+ info?: TenantInfo;
129
+ }
130
+
131
+ /**
132
+ * TenantInfo provides read-only server-derived data about a tenant.
133
+ */
134
+ export interface TenantInfo {
135
+ /**
136
+ * Number of objectives associated with this tenant, across every surface — widget
137
+ * conversations and objectives created directly against the API alike. This is the
138
+ * footprint a delete would destroy, which is why it is worth the count query that
139
+ * populating `info` costs.
140
+ */
141
+ objectiveCount?: number;
142
+
143
+ /**
144
+ * Number of subjects asserted under this tenant.
145
+ */
146
+ subjectCount?: number;
147
+
148
+ /**
149
+ * Number of widget sessions minted for this tenant that still exist.
150
+ */
151
+ widgetSessionCount?: number;
152
+ }
153
+
154
+ export interface TenantRetrieveParams {
155
+ /**
156
+ * Path param: Workspace ID.
157
+ */
158
+ workspaceId?: string;
159
+
160
+ /**
161
+ * Query param: When true, the `info` field is populated.
162
+ */
163
+ includeInfo?: boolean;
164
+ }
165
+
166
+ export interface TenantListParams extends CursorPaginationParams {
167
+ /**
168
+ * Path param: Workspace ID.
169
+ */
170
+ workspaceId?: string;
171
+
172
+ /**
173
+ * Query param: When true, the `info` field on each returned tenant is populated.
174
+ * This costs several count queries per tenant, so it is off by default.
175
+ */
176
+ includeInfo?: boolean;
177
+
178
+ /**
179
+ * Query param: Filters by metadata labels. Comma-separated key=value pairs, e.g.
180
+ * "env=prod,team=ai". A resource matches only if every pair matches exactly (AND
181
+ * semantics).
182
+ */
183
+ labels?: string;
184
+
185
+ /**
186
+ * Query param: Substring match against the tenant's name and external_id. Built
187
+ * for type-ahead filter pickers, where the operator knows the customer's own
188
+ * identifier rather than Cadenya's.
189
+ */
190
+ query?: string;
191
+
192
+ /**
193
+ * Query param: Sort order for results (asc or desc by creation time).
194
+ */
195
+ sortOrder?: string;
196
+ }
197
+
198
+ export interface TenantDeleteParams {
199
+ /**
200
+ * Workspace ID.
201
+ */
202
+ workspaceId?: string;
203
+ }
204
+
205
+ Tenants.Subjects = Subjects;
206
+
207
+ export declare namespace Tenants {
208
+ export {
209
+ type Subject as Subject,
210
+ type SubjectInfo as SubjectInfo,
211
+ type Tenant as Tenant,
212
+ type TenantInfo as TenantInfo,
213
+ type TenantsCursorPagination as TenantsCursorPagination,
214
+ type TenantRetrieveParams as TenantRetrieveParams,
215
+ type TenantListParams as TenantListParams,
216
+ type TenantDeleteParams as TenantDeleteParams,
217
+ };
218
+
219
+ export { Subjects as Subjects, type SubjectListParams as SubjectListParams };
220
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './tenants/index';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.130.0'; // x-release-please-version
1
+ export const VERSION = '0.132.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.130.0";
1
+ export declare const VERSION = "0.132.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.130.0";
1
+ export declare const VERSION = "0.132.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.130.0'; // x-release-please-version
4
+ exports.VERSION = '0.132.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.130.0'; // x-release-please-version
1
+ export const VERSION = '0.132.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map