@cadenya/cadenya 0.131.0 → 0.132.1
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.
- package/CHANGELOG.md +21 -0
- package/client.d.mts +9 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -0
- package/client.d.ts.map +1 -1
- package/client.js +9 -0
- package/client.js.map +1 -1
- package/client.mjs +9 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/tenants/index.d.mts +3 -0
- package/resources/tenants/index.d.mts.map +1 -0
- package/resources/tenants/index.d.ts +3 -0
- package/resources/tenants/index.d.ts.map +1 -0
- package/resources/tenants/index.js +9 -0
- package/resources/tenants/index.js.map +1 -0
- package/resources/tenants/index.mjs +4 -0
- package/resources/tenants/index.mjs.map +1 -0
- package/resources/tenants/subjects.d.mts +43 -0
- package/resources/tenants/subjects.d.mts.map +1 -0
- package/resources/tenants/subjects.d.ts +43 -0
- package/resources/tenants/subjects.d.ts.map +1 -0
- package/resources/tenants/subjects.js +27 -0
- package/resources/tenants/subjects.js.map +1 -0
- package/resources/tenants/subjects.mjs +23 -0
- package/resources/tenants/subjects.mjs.map +1 -0
- package/resources/tenants/tenants.d.mts +158 -0
- package/resources/tenants/tenants.d.mts.map +1 -0
- package/resources/tenants/tenants.d.ts +158 -0
- package/resources/tenants/tenants.d.ts.map +1 -0
- package/resources/tenants/tenants.js +58 -0
- package/resources/tenants/tenants.js.map +1 -0
- package/resources/tenants/tenants.mjs +53 -0
- package/resources/tenants/tenants.mjs.map +1 -0
- package/resources/tenants.d.mts +2 -0
- package/resources/tenants.d.mts.map +1 -0
- package/resources/tenants.d.ts +2 -0
- package/resources/tenants.d.ts.map +1 -0
- package/resources/tenants.js +6 -0
- package/resources/tenants.js.map +1 -0
- package/resources/tenants.mjs +3 -0
- package/resources/tenants.mjs.map +1 -0
- package/src/client.ts +31 -0
- package/src/resources/index.ts +12 -0
- package/src/resources/tenants/index.ts +15 -0
- package/src/resources/tenants/subjects.ts +63 -0
- package/src/resources/tenants/tenants.ts +220 -0
- package/src/resources/tenants.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
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.Tenants = void 0;
|
|
5
|
+
const tslib_1 = require("../../internal/tslib.js");
|
|
6
|
+
const resource_1 = require("../../core/resource.js");
|
|
7
|
+
const SubjectsAPI = tslib_1.__importStar(require("./subjects.js"));
|
|
8
|
+
const subjects_1 = require("./subjects.js");
|
|
9
|
+
const pagination_1 = require("../../core/pagination.js");
|
|
10
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
11
|
+
/**
|
|
12
|
+
* Read and erase tenants and the subjects under them. Tenants and subjects are
|
|
13
|
+
* created by assertion — on objective creation or widget session mint — never
|
|
14
|
+
* directly, so this service has no create or update: it exists to enumerate what
|
|
15
|
+
* assertions have produced, and to destroy it on request.
|
|
16
|
+
*/
|
|
17
|
+
class Tenants extends resource_1.APIResource {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.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(id, params = {}, options) {
|
|
27
|
+
const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
|
|
28
|
+
return this._client.get((0, path_1.path) `/v1/workspaces/${workspaceId}/tenants/${id}`, { query, ...options });
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Lists the tenants asserted in a workspace, newest first. `query` matches against
|
|
32
|
+
* a tenant's name and its external_id, for type-ahead filters.
|
|
33
|
+
*/
|
|
34
|
+
list(params = {}, options) {
|
|
35
|
+
const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
|
|
36
|
+
return this._client.getAPIList((0, path_1.path) `/v1/workspaces/${workspaceId}/tenants`, (pagination_1.CursorPagination), {
|
|
37
|
+
query,
|
|
38
|
+
...options,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Destroys the tenant, its subjects, every objective associated with it and
|
|
43
|
+
* everything reachable from those objectives, and its widget sessions. This is the
|
|
44
|
+
* full erasure hammer, wider than `DELETE /widget_sessions`, which removes only
|
|
45
|
+
* what widget sessions created. The work runs in the background: this returns the
|
|
46
|
+
* tenant in STATE_ERASING rather than a count of what was removed, since a large
|
|
47
|
+
* tenant's history cannot be destroyed inside a request. Poll the tenant to follow
|
|
48
|
+
* it — STATE_ERASING while it runs, NotFound once it finishes. Erasure is
|
|
49
|
+
* terminal; a tenant cannot be recovered once it starts.
|
|
50
|
+
*/
|
|
51
|
+
delete(id, params = {}, options) {
|
|
52
|
+
const { workspaceId = this._client.workspaceID } = params ?? {};
|
|
53
|
+
return this._client.delete((0, path_1.path) `/v1/workspaces/${workspaceId}/tenants/${id}`, options);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Tenants = Tenants;
|
|
57
|
+
Tenants.Subjects = subjects_1.Subjects;
|
|
58
|
+
//# sourceMappingURL=tenants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenants.js","sourceRoot":"","sources":["../../src/resources/tenants/tenants.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAGlD,mEAA0C;AAC1C,4CAAyD;AAEzD,yDAAmG;AAEnG,uDAAiD;AAEjD;;;;;GAKG;AACH,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAgD1E,CAAC;IA9CC;;;OAGG;IACH,QAAQ,CACN,EAAU,EACV,SAAkD,EAAE,EACpD,OAAwB;QAExB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,kBAAkB,WAAW,YAAY,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpG,CAAC;IAED;;;OAGG;IACH,IAAI,CACF,SAA8C,EAAE,EAChD,OAAwB;QAExB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAA,WAAI,EAAA,kBAAkB,WAAW,UAAU,EAAE,CAAA,6BAAwB,CAAA,EAAE;YACpG,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CACJ,EAAU,EACV,SAAgD,EAAE,EAClD,OAAwB;QAExB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,kBAAkB,WAAW,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;CACF;AAjDD,0BAiDC;AAyID,OAAO,CAAC,QAAQ,GAAG,mBAAQ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import * as SubjectsAPI from "./subjects.mjs";
|
|
4
|
+
import { Subjects } from "./subjects.mjs";
|
|
5
|
+
import { CursorPagination } from "../../core/pagination.mjs";
|
|
6
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
7
|
+
/**
|
|
8
|
+
* Read and erase tenants and the subjects under them. Tenants and subjects are
|
|
9
|
+
* created by assertion — on objective creation or widget session mint — never
|
|
10
|
+
* directly, so this service has no create or update: it exists to enumerate what
|
|
11
|
+
* assertions have produced, and to destroy it on request.
|
|
12
|
+
*/
|
|
13
|
+
export class Tenants extends APIResource {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.subjects = new SubjectsAPI.Subjects(this._client);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves a tenant by its canonical id or by the `external_id:<value>` form the
|
|
20
|
+
* customer asserted it under.
|
|
21
|
+
*/
|
|
22
|
+
retrieve(id, params = {}, options) {
|
|
23
|
+
const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
|
|
24
|
+
return this._client.get(path `/v1/workspaces/${workspaceId}/tenants/${id}`, { query, ...options });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Lists the tenants asserted in a workspace, newest first. `query` matches against
|
|
28
|
+
* a tenant's name and its external_id, for type-ahead filters.
|
|
29
|
+
*/
|
|
30
|
+
list(params = {}, options) {
|
|
31
|
+
const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
|
|
32
|
+
return this._client.getAPIList(path `/v1/workspaces/${workspaceId}/tenants`, (CursorPagination), {
|
|
33
|
+
query,
|
|
34
|
+
...options,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Destroys the tenant, its subjects, every objective associated with it and
|
|
39
|
+
* everything reachable from those objectives, and its widget sessions. This is the
|
|
40
|
+
* full erasure hammer, wider than `DELETE /widget_sessions`, which removes only
|
|
41
|
+
* what widget sessions created. The work runs in the background: this returns the
|
|
42
|
+
* tenant in STATE_ERASING rather than a count of what was removed, since a large
|
|
43
|
+
* tenant's history cannot be destroyed inside a request. Poll the tenant to follow
|
|
44
|
+
* it — STATE_ERASING while it runs, NotFound once it finishes. Erasure is
|
|
45
|
+
* terminal; a tenant cannot be recovered once it starts.
|
|
46
|
+
*/
|
|
47
|
+
delete(id, params = {}, options) {
|
|
48
|
+
const { workspaceId = this._client.workspaceID } = params ?? {};
|
|
49
|
+
return this._client.delete(path `/v1/workspaces/${workspaceId}/tenants/${id}`, options);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
Tenants.Subjects = Subjects;
|
|
53
|
+
//# sourceMappingURL=tenants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenants.mjs","sourceRoot":"","sources":["../../src/resources/tenants/tenants.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAGlD,OAAO,KAAK,WAAW,uBAAmB;AAC1C,OAAO,EAAqB,QAAQ,EAAE,uBAAmB;AAEzD,OAAO,EAAE,gBAAgB,EAA4C,kCAA8B;AAEnG,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAAxC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAgD1E,CAAC;IA9CC;;;OAGG;IACH,QAAQ,CACN,EAAU,EACV,SAAkD,EAAE,EACpD,OAAwB;QAExB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,kBAAkB,WAAW,YAAY,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpG,CAAC;IAED;;;OAGG;IACH,IAAI,CACF,SAA8C,EAAE,EAChD,OAAwB;QAExB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA,kBAAkB,WAAW,UAAU,EAAE,CAAA,gBAAwB,CAAA,EAAE;YACpG,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CACJ,EAAU,EACV,SAAgD,EAAE,EAClD,OAAwB;QAExB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,kBAAkB,WAAW,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;CACF;AAyID,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenants.d.mts","sourceRoot":"","sources":["../src/resources/tenants.ts"],"names":[],"mappings":"AAEA,oCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenants.d.ts","sourceRoot":"","sources":["../src/resources/tenants.ts"],"names":[],"mappings":"AAEA,mCAAgC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./tenants/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=tenants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenants.js","sourceRoot":"","sources":["../src/resources/tenants.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6DAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenants.mjs","sourceRoot":"","sources":["../src/resources/tenants.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,oCAAgC"}
|
package/src/client.ts
CHANGED
|
@@ -234,6 +234,17 @@ import {
|
|
|
234
234
|
ToolResult,
|
|
235
235
|
UserMessage,
|
|
236
236
|
} from './resources/objectives/objectives';
|
|
237
|
+
import {
|
|
238
|
+
Subject,
|
|
239
|
+
SubjectInfo,
|
|
240
|
+
Tenant,
|
|
241
|
+
TenantDeleteParams,
|
|
242
|
+
TenantInfo,
|
|
243
|
+
TenantListParams,
|
|
244
|
+
TenantRetrieveParams,
|
|
245
|
+
Tenants,
|
|
246
|
+
TenantsCursorPagination,
|
|
247
|
+
} from './resources/tenants/tenants';
|
|
237
248
|
import {
|
|
238
249
|
ApprovalRequirementFilter,
|
|
239
250
|
ApprovalRequirementFilterAlways,
|
|
@@ -1140,6 +1151,13 @@ export class Cadenya {
|
|
|
1140
1151
|
* session tokens minted via WidgetSessionService.
|
|
1141
1152
|
*/
|
|
1142
1153
|
widgets: API.Widgets = new API.Widgets(this);
|
|
1154
|
+
/**
|
|
1155
|
+
* Read and erase tenants and the subjects under them. Tenants and subjects are
|
|
1156
|
+
* created by assertion — on objective creation or widget session mint — never
|
|
1157
|
+
* directly, so this service has no create or update: it exists to enumerate what
|
|
1158
|
+
* assertions have produced, and to destroy it on request.
|
|
1159
|
+
*/
|
|
1160
|
+
tenants: API.Tenants = new API.Tenants(this);
|
|
1143
1161
|
/**
|
|
1144
1162
|
* Mint and manage widget sessions. Session creation is server-to-server only:
|
|
1145
1163
|
* the customer's backend authenticates its visitor, asserts tenant/subject
|
|
@@ -1166,6 +1184,7 @@ Cadenya.Workspaces = Workspaces;
|
|
|
1166
1184
|
Cadenya.WorkspaceAdmin = WorkspaceAdmin;
|
|
1167
1185
|
Cadenya.Webhooks = Webhooks;
|
|
1168
1186
|
Cadenya.Widgets = Widgets;
|
|
1187
|
+
Cadenya.Tenants = Tenants;
|
|
1169
1188
|
Cadenya.WidgetSessions = WidgetSessions;
|
|
1170
1189
|
|
|
1171
1190
|
export declare namespace Cadenya {
|
|
@@ -1455,6 +1474,18 @@ export declare namespace Cadenya {
|
|
|
1455
1474
|
type WidgetUnarchiveParams as WidgetUnarchiveParams,
|
|
1456
1475
|
};
|
|
1457
1476
|
|
|
1477
|
+
export {
|
|
1478
|
+
Tenants as Tenants,
|
|
1479
|
+
type Subject as Subject,
|
|
1480
|
+
type SubjectInfo as SubjectInfo,
|
|
1481
|
+
type Tenant as Tenant,
|
|
1482
|
+
type TenantInfo as TenantInfo,
|
|
1483
|
+
type TenantsCursorPagination as TenantsCursorPagination,
|
|
1484
|
+
type TenantRetrieveParams as TenantRetrieveParams,
|
|
1485
|
+
type TenantListParams as TenantListParams,
|
|
1486
|
+
type TenantDeleteParams as TenantDeleteParams,
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1458
1489
|
export {
|
|
1459
1490
|
WidgetSessions as WidgetSessions,
|
|
1460
1491
|
type SubjectAssertion as SubjectAssertion,
|
package/src/resources/index.ts
CHANGED
|
@@ -157,6 +157,18 @@ export {
|
|
|
157
157
|
type SearchSearchToolsOrToolSetsResponse,
|
|
158
158
|
type SearchSearchToolsOrToolSetsParams,
|
|
159
159
|
} from './search';
|
|
160
|
+
export {
|
|
161
|
+
Tenants,
|
|
162
|
+
type Subject,
|
|
163
|
+
type SubjectInfo,
|
|
164
|
+
type Tenant,
|
|
165
|
+
type TenantInfo,
|
|
166
|
+
type TenantRetrieveParams,
|
|
167
|
+
type TenantListParams,
|
|
168
|
+
type TenantDeleteParams,
|
|
169
|
+
type SubjectsCursorPagination,
|
|
170
|
+
type TenantsCursorPagination,
|
|
171
|
+
} from './tenants/tenants';
|
|
160
172
|
export {
|
|
161
173
|
ToolSets,
|
|
162
174
|
type ApprovalRequirementFilter,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export { Subjects, type SubjectListParams } from './subjects';
|
|
4
|
+
export {
|
|
5
|
+
Tenants,
|
|
6
|
+
type Subject,
|
|
7
|
+
type SubjectInfo,
|
|
8
|
+
type Tenant,
|
|
9
|
+
type TenantInfo,
|
|
10
|
+
type TenantRetrieveParams,
|
|
11
|
+
type TenantListParams,
|
|
12
|
+
type TenantDeleteParams,
|
|
13
|
+
type SubjectsCursorPagination,
|
|
14
|
+
type TenantsCursorPagination,
|
|
15
|
+
} from './tenants';
|
|
@@ -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
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.132.1'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.132.1";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.132.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.132.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|