@dremio/js-sdk 0.46.1 → 0.47.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.
- package/dist/cloud/users/CloudUser.js +1 -1
- package/dist/cloud/users/CloudUser.js.map +1 -1
- package/dist/cloud/users/User.d.ts +3 -3
- package/dist/cloud/users/User.js +2 -2
- package/dist/cloud/users/User.js.map +1 -1
- package/dist/cloud/users/UsersResource.d.ts +33 -19
- package/dist/cloud/users/UsersResource.js +86 -24
- package/dist/cloud/users/UsersResource.js.map +1 -1
- package/dist/cloud/users/userPropertiesCodec.d.ts +19 -29
- package/dist/cloud/users/userPropertiesCodec.js +23 -23
- package/dist/cloud/users/userPropertiesCodec.js.map +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.js +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.js.map +1 -1
- package/dist-iife/cloud.js +112 -79
- package/dist-iife/enterprise.js +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ import { EnterpriseUser, } from "../../enterprise/users/EnterpriseUser.js";
|
|
|
20
20
|
export class CloudUser extends EnterpriseUser {
|
|
21
21
|
}
|
|
22
22
|
export const cloudUserEntityToProperties = (entity) => ({
|
|
23
|
-
email: entity.
|
|
23
|
+
email: entity.name,
|
|
24
24
|
familyName: entity.lastName || null,
|
|
25
25
|
givenName: entity.firstName || null,
|
|
26
26
|
id: entity.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudUser.js","sourceRoot":"","sources":["../../../src/cloud/users/CloudUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,cAAc;CAAG;AAEhD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAW,EAAE,EAAE,CACzD,CAAC;IACC,KAAK,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"CloudUser.js","sourceRoot":"","sources":["../../../src/cloud/users/CloudUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,cAAc;CAAG;AAEhD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAW,EAAE,EAAE,CACzD,CAAC;IACC,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,UAAU,EAAE,MAAM,CAAC,QAAQ,IAAI,IAAI;IACnC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,IAAI;IACnC,EAAE,EAAE,MAAM,CAAC,EAAE;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;IAC7C,QAAQ,EAAE,MAAM,CAAC,IAAI;CACtB,CAA6B,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n EnterpriseUser,\n type EnterpriseUserProperties,\n} from \"../../enterprise/users/EnterpriseUser.ts\";\n\n/**\n * @deprecated\n */\nexport class CloudUser extends EnterpriseUser {}\n\nexport const cloudUserEntityToProperties = (entity: any) =>\n ({\n email: entity.name,\n familyName: entity.lastName || null,\n givenName: entity.firstName || null,\n id: entity.id,\n status: entity.active ? \"ACTIVE\" : \"INACTIVE\",\n username: entity.name,\n }) as EnterpriseUserProperties;\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
2
|
import type { userPropertiesCodec } from "./userPropertiesCodec.ts";
|
|
3
|
-
import type {
|
|
3
|
+
import type { V3Config } from "../../common/Config.ts";
|
|
4
4
|
export declare class User implements z.output<typeof userPropertiesCodec> {
|
|
5
5
|
#private;
|
|
6
6
|
readonly email: string | null;
|
|
7
7
|
readonly familyName: string | null;
|
|
8
8
|
readonly givenName: string | null;
|
|
9
9
|
readonly id: string;
|
|
10
|
-
readonly
|
|
10
|
+
readonly identityType: z.output<typeof userPropertiesCodec>["identityType"];
|
|
11
11
|
readonly status: z.output<typeof userPropertiesCodec>["status"];
|
|
12
12
|
readonly username: string;
|
|
13
|
-
constructor(config:
|
|
13
|
+
constructor(config: V3Config, properties: z.output<typeof userPropertiesCodec>);
|
|
14
14
|
get displayName(): string;
|
|
15
15
|
get initials(): string;
|
|
16
16
|
}
|
package/dist/cloud/users/User.js
CHANGED
|
@@ -21,7 +21,7 @@ export class User {
|
|
|
21
21
|
familyName;
|
|
22
22
|
givenName;
|
|
23
23
|
id;
|
|
24
|
-
|
|
24
|
+
identityType;
|
|
25
25
|
status;
|
|
26
26
|
username;
|
|
27
27
|
constructor(config, properties) {
|
|
@@ -30,7 +30,7 @@ export class User {
|
|
|
30
30
|
this.familyName = properties.familyName;
|
|
31
31
|
this.givenName = properties.givenName;
|
|
32
32
|
this.id = properties.id;
|
|
33
|
-
this.
|
|
33
|
+
this.identityType = properties.identityType;
|
|
34
34
|
this.status = properties.status;
|
|
35
35
|
this.username = properties.username;
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/cloud/users/User.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,MAAM,OAAO,IAAI;IACf,2DAA2D;IAClD,OAAO,CAAW;IAClB,KAAK,CAAgB;IACrB,UAAU,CAAgB;IAC1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KAAK,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED,IAAI,QAAQ;QACV,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { userPropertiesCodec } from \"./userPropertiesCodec.ts\";\nimport type { V3Config } from \"../../common/Config.ts\";\n\nexport class User implements z.output<typeof userPropertiesCodec> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V3Config;\n readonly email: string | null;\n readonly familyName: string | null;\n readonly givenName: string | null;\n readonly id: string;\n readonly identityType: z.output<typeof userPropertiesCodec>[\"identityType\"];\n readonly status: z.output<typeof userPropertiesCodec>[\"status\"];\n readonly username: string;\n\n constructor(config: V3Config, properties: z.output<typeof userPropertiesCodec>) {\n this.#config = config;\n this.email = properties.email;\n this.familyName = properties.familyName;\n this.givenName = properties.givenName;\n this.id = properties.id;\n this.identityType = properties.identityType;\n this.status = properties.status;\n this.username = properties.username;\n }\n\n get displayName(): string {\n if (this.givenName || this.familyName) {\n return [this.givenName, this.familyName].filter(Boolean).join(\" \");\n }\n\n if (this.username) {\n return this.username;\n }\n\n if (this.email) {\n return this.email;\n }\n\n return this.id;\n }\n\n get initials(): string {\n if (this.givenName && this.familyName) {\n return this.givenName.charAt(0) + this.familyName.charAt(0);\n }\n\n return this.displayName.slice(0, 2);\n }\n}\n"]}
|
|
@@ -1,30 +1,44 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
import type { V3Config } from "../../common/Config.ts";
|
|
2
3
|
import type { SignalParam } from "../../common/Params.ts";
|
|
3
4
|
import { User } from "./User.ts";
|
|
5
|
+
import type { identityTypeSchema } from "./userPropertiesCodec.js";
|
|
6
|
+
type CreateUserParams = {
|
|
7
|
+
name: string;
|
|
8
|
+
identityType?: z.output<typeof identityTypeSchema>;
|
|
9
|
+
description?: string;
|
|
10
|
+
};
|
|
11
|
+
type UpdateUserParams = {
|
|
12
|
+
firstName?: string;
|
|
13
|
+
lastName?: string;
|
|
14
|
+
};
|
|
4
15
|
export declare class UsersResource {
|
|
5
16
|
#private;
|
|
6
|
-
constructor(config:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
constructor(config: V3Config);
|
|
18
|
+
list(params?: {
|
|
19
|
+
filter?: string;
|
|
20
|
+
maxResults?: number;
|
|
21
|
+
orderBy?: string;
|
|
22
|
+
}): {
|
|
11
23
|
data({ signal }?: SignalParam): AsyncGenerator<User, void, unknown>;
|
|
12
|
-
getPage: ({
|
|
13
|
-
|
|
14
|
-
offset: number;
|
|
24
|
+
getPage: ({ pageToken, signal }?: {
|
|
25
|
+
pageToken?: string;
|
|
15
26
|
} & SignalParam) => import("ts-results-es").AsyncResult<{
|
|
16
27
|
data: User[];
|
|
17
|
-
|
|
18
|
-
startIndex: number;
|
|
28
|
+
nextPageToken?: string;
|
|
19
29
|
totalResults: number;
|
|
20
30
|
}, import("../index.ts").HttpError>;
|
|
21
31
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
create(params: CreateUserParams, { signal }?: SignalParam): import("ts-results-es").AsyncResult<User, import("../index.ts").HttpError>;
|
|
33
|
+
retrieveById(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<User, import("../index.ts").HttpError>;
|
|
34
|
+
retrieveByName(name: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<User, import("../index.ts").HttpError>;
|
|
35
|
+
update(id: string, params: UpdateUserParams, { signal }?: SignalParam): import("ts-results-es").AsyncResult<User, import("../index.ts").HttpError>;
|
|
36
|
+
delete(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<Response, import("../index.ts").HttpError>;
|
|
37
|
+
listParentRoles(userId: string, params?: {
|
|
38
|
+
maxResults?: number;
|
|
39
|
+
pageToken?: string;
|
|
40
|
+
}, { signal }?: SignalParam): import("ts-results-es").AsyncResult<Response, import("../index.ts").HttpError>;
|
|
41
|
+
addParentRole(userId: string, roleId: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<Response, import("../index.ts").HttpError>;
|
|
42
|
+
removeParentRole(userId: string, roleId: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<Response, import("../index.ts").HttpError>;
|
|
30
43
|
}
|
|
44
|
+
export {};
|
|
@@ -21,14 +21,24 @@ export class UsersResource {
|
|
|
21
21
|
constructor(config) {
|
|
22
22
|
this.#config = config;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
list(params) {
|
|
25
|
+
const buildQuery = (extra) => {
|
|
26
|
+
const query = new URLSearchParams();
|
|
27
|
+
if (params?.filter)
|
|
28
|
+
query.set("filter", params.filter);
|
|
29
|
+
if (params?.maxResults)
|
|
30
|
+
query.set("maxResults", String(params.maxResults));
|
|
31
|
+
if (params?.orderBy)
|
|
32
|
+
query.set("orderBy", params.orderBy);
|
|
33
|
+
if (extra?.pageToken)
|
|
34
|
+
query.set("pageToken", extra.pageToken);
|
|
35
|
+
return query;
|
|
36
|
+
};
|
|
37
|
+
const getPage = ({ pageToken, signal } = {}) => this.#config
|
|
38
|
+
.v3Request(`users?${buildQuery({ pageToken })}`, {
|
|
39
|
+
headers: { Accept: "application/json" },
|
|
40
|
+
signal,
|
|
41
|
+
})
|
|
32
42
|
.map((res) => res.json())
|
|
33
43
|
.map((page) => ({
|
|
34
44
|
...page,
|
|
@@ -36,50 +46,102 @@ export class UsersResource {
|
|
|
36
46
|
}));
|
|
37
47
|
return {
|
|
38
48
|
async *data({ signal } = {}) {
|
|
39
|
-
const
|
|
40
|
-
let offset = 0;
|
|
41
|
-
const firstPageResult = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise;
|
|
49
|
+
const firstPageResult = await getPage({ signal }).promise;
|
|
42
50
|
if (firstPageResult.isErr()) {
|
|
43
51
|
throw firstPageResult.error;
|
|
44
52
|
}
|
|
45
53
|
let currentPage = firstPageResult.value;
|
|
46
54
|
yield* currentPage.data;
|
|
47
|
-
while (currentPage.
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
while (currentPage.nextPageToken) {
|
|
56
|
+
currentPage = await getPage({
|
|
57
|
+
pageToken: currentPage.nextPageToken,
|
|
58
|
+
signal,
|
|
59
|
+
}).promise.then((result) => result.unwrap());
|
|
50
60
|
yield* currentPage.data;
|
|
51
61
|
}
|
|
52
62
|
},
|
|
53
63
|
getPage,
|
|
54
64
|
};
|
|
55
65
|
}
|
|
56
|
-
|
|
57
|
-
* @deprecated
|
|
58
|
-
*/
|
|
59
|
-
_retrieveById(id, { signal } = {}) {
|
|
66
|
+
create(params, { signal } = {}) {
|
|
60
67
|
return this.#config
|
|
61
|
-
.
|
|
68
|
+
.v3Request("users", {
|
|
69
|
+
body: JSON.stringify(params),
|
|
62
70
|
headers: {
|
|
63
71
|
Accept: "application/json",
|
|
72
|
+
"Content-Type": "application/json",
|
|
64
73
|
},
|
|
74
|
+
method: "POST",
|
|
75
|
+
signal,
|
|
76
|
+
})
|
|
77
|
+
.map((res) => res.json())
|
|
78
|
+
.map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));
|
|
79
|
+
}
|
|
80
|
+
retrieveById(id, { signal } = {}) {
|
|
81
|
+
return this.#config
|
|
82
|
+
.v3Request(`users/${id}`, {
|
|
83
|
+
headers: { Accept: "application/json" },
|
|
84
|
+
signal,
|
|
85
|
+
})
|
|
86
|
+
.map((res) => res.json())
|
|
87
|
+
.map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));
|
|
88
|
+
}
|
|
89
|
+
retrieveByName(name, { signal } = {}) {
|
|
90
|
+
return this.#config
|
|
91
|
+
.v3Request(`users/names/${name}`, {
|
|
92
|
+
headers: { Accept: "application/json" },
|
|
65
93
|
signal,
|
|
66
94
|
})
|
|
67
95
|
.map((res) => res.json())
|
|
68
96
|
.map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));
|
|
69
97
|
}
|
|
70
|
-
|
|
71
|
-
* @deprecated
|
|
72
|
-
*/
|
|
73
|
-
_retrieveByUsername(username, { signal } = {}) {
|
|
98
|
+
update(id, params, { signal } = {}) {
|
|
74
99
|
return this.#config
|
|
75
|
-
.
|
|
100
|
+
.v3Request(`users/${id}`, {
|
|
101
|
+
body: JSON.stringify(params),
|
|
76
102
|
headers: {
|
|
77
103
|
Accept: "application/json",
|
|
104
|
+
"Content-Type": "application/json",
|
|
78
105
|
},
|
|
106
|
+
method: "PUT",
|
|
79
107
|
signal,
|
|
80
108
|
})
|
|
81
109
|
.map((res) => res.json())
|
|
82
110
|
.map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));
|
|
83
111
|
}
|
|
112
|
+
delete(id, { signal } = {}) {
|
|
113
|
+
return this.#config.v3Request(`users/${id}`, {
|
|
114
|
+
method: "DELETE",
|
|
115
|
+
signal,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
listParentRoles(userId, params, { signal } = {}) {
|
|
119
|
+
const query = new URLSearchParams();
|
|
120
|
+
if (params?.maxResults)
|
|
121
|
+
query.set("maxResults", String(params.maxResults));
|
|
122
|
+
if (params?.pageToken)
|
|
123
|
+
query.set("pageToken", params.pageToken);
|
|
124
|
+
return this.#config.v3Request(`users/${userId}/parent-roles?${query}`, {
|
|
125
|
+
headers: { Accept: "application/json" },
|
|
126
|
+
signal,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
addParentRole(userId, roleId, { signal } = {}) {
|
|
130
|
+
return this.#config.v3Request(`users/${userId}/parent-roles`, {
|
|
131
|
+
body: JSON.stringify({ id: roleId }),
|
|
132
|
+
headers: {
|
|
133
|
+
Accept: "application/json",
|
|
134
|
+
"Content-Type": "application/json",
|
|
135
|
+
},
|
|
136
|
+
method: "POST",
|
|
137
|
+
signal,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
removeParentRole(userId, roleId, { signal } = {}) {
|
|
141
|
+
return this.#config.v3Request(`users/${userId}/parent-roles/${roleId}`, {
|
|
142
|
+
method: "DELETE",
|
|
143
|
+
signal,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
84
146
|
}
|
|
85
147
|
//# sourceMappingURL=UsersResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsersResource.js","sourceRoot":"","sources":["../../../src/cloud/users/UsersResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,OAAO,aAAa;IACxB,OAAO,CAAW;IAElB,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,MAAM,OAAO,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AM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { V2Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { userPropertiesCodec } from \"./userPropertiesCodec.js\";\nimport { User } from \"./User.ts\";\n\nexport class UsersResource {\n #config: V2Config;\n\n constructor(config: V2Config) {\n this.#config = config;\n }\n\n /**\n * @deprecated\n */\n _list() {\n const getPage = ({ limit, offset, signal }: { limit: number; offset: number } & SignalParam) =>\n this.#config\n .v2Request(\n // startIndex for this API must be >= 1\n `user?${new URLSearchParams({ count: String(limit), startIndex: String(offset + 1) }).toString()}`,\n { headers: { Accept: \"application/json\" }, signal },\n )\n .map(\n (res) =>\n res.json() as Promise<{\n data: z.input<typeof userPropertiesCodec>[];\n itemsPerPage: number;\n startIndex: number;\n totalResults: number;\n }>,\n )\n .map((page) => ({\n ...page,\n data: page.data.map(\n (entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)),\n ),\n }));\n\n return {\n async *data({ signal }: SignalParam = {}) {\n const USERS_PAGE_SIZE = 100;\n let offset = 0;\n const firstPageResult = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise;\n if (firstPageResult.isErr()) {\n throw firstPageResult.error;\n }\n let currentPage = firstPageResult.value;\n yield* currentPage.data;\n while (currentPage.totalResults > offset - 1 + USERS_PAGE_SIZE) {\n offset += USERS_PAGE_SIZE;\n currentPage = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise.then(\n (result) => result.unwrap(),\n );\n yield* currentPage.data;\n }\n },\n getPage,\n };\n }\n\n /**\n * @deprecated\n */\n _retrieveById(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .v2Request(`user/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n\n /**\n * @deprecated\n */\n _retrieveByUsername(username: string, { signal }: SignalParam = {}) {\n return this.#config\n .v2Request(`user/by-name/${username}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UsersResource.js","sourceRoot":"","sources":["../../../src/cloud/users/UsersResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAoBjC,MAAM,OAAO,aAAa;IACxB,OAAO,CAAW;IAElB,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,MAAmE;QACtE,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAE,EAAE;YACpD,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;YACpC,IAAI,MAAM,EAAE,MAAM;gBAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,MAAM,EAAE,UAAU;gBAAE,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC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-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { userPropertiesCodec } from \"./userPropertiesCodec.js\";\nimport { User } from \"./User.ts\";\nimport type { identityTypeSchema } from \"./userPropertiesCodec.js\";\n\ntype PaginatedUserListResponse = {\n data: z.input<typeof userPropertiesCodec>[];\n nextPageToken?: string;\n totalResults: number;\n};\n\ntype CreateUserParams = {\n name: string;\n identityType?: z.output<typeof identityTypeSchema>;\n description?: string;\n};\n\ntype UpdateUserParams = {\n firstName?: string;\n lastName?: string;\n};\n\nexport class UsersResource {\n #config: V3Config;\n\n constructor(config: V3Config) {\n this.#config = config;\n }\n\n list(params?: { filter?: string; maxResults?: number; orderBy?: string }) {\n const buildQuery = (extra?: { pageToken?: string }) => {\n const query = new URLSearchParams();\n if (params?.filter) query.set(\"filter\", params.filter);\n if (params?.maxResults) query.set(\"maxResults\", String(params.maxResults));\n if (params?.orderBy) query.set(\"orderBy\", params.orderBy);\n if (extra?.pageToken) query.set(\"pageToken\", extra.pageToken);\n return query;\n };\n\n const getPage = ({ pageToken, signal }: { pageToken?: string } & SignalParam = {}) =>\n this.#config\n .v3Request(`users?${buildQuery({ pageToken })}`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .map((res) => res.json() as Promise<PaginatedUserListResponse>)\n .map((page) => ({\n ...page,\n data: page.data.map(\n (entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)),\n ),\n }));\n\n return {\n async *data({ signal }: SignalParam = {}) {\n const firstPageResult = await getPage({ signal }).promise;\n if (firstPageResult.isErr()) {\n throw firstPageResult.error;\n }\n let currentPage = firstPageResult.value;\n yield* currentPage.data;\n while (currentPage.nextPageToken) {\n currentPage = await getPage({\n pageToken: currentPage.nextPageToken,\n signal,\n }).promise.then((result) => result.unwrap());\n yield* currentPage.data;\n }\n },\n getPage,\n };\n }\n\n create(params: CreateUserParams, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(\"users\", {\n body: JSON.stringify(params),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n method: \"POST\",\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n\n retrieveById(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`users/${id}`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n\n retrieveByName(name: string, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`users/names/${name}`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n\n update(id: string, params: UpdateUserParams, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`users/${id}`, {\n body: JSON.stringify(params),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n method: \"PUT\",\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n\n delete(id: string, { signal }: SignalParam = {}) {\n return this.#config.v3Request(`users/${id}`, {\n method: \"DELETE\",\n signal,\n });\n }\n\n listParentRoles(\n userId: string,\n params?: { maxResults?: number; pageToken?: string },\n { signal }: SignalParam = {},\n ) {\n const query = new URLSearchParams();\n if (params?.maxResults) query.set(\"maxResults\", String(params.maxResults));\n if (params?.pageToken) query.set(\"pageToken\", params.pageToken);\n\n return this.#config.v3Request(`users/${userId}/parent-roles?${query}`, {\n headers: { Accept: \"application/json\" },\n signal,\n });\n }\n\n addParentRole(userId: string, roleId: string, { signal }: SignalParam = {}) {\n return this.#config.v3Request(`users/${userId}/parent-roles`, {\n body: JSON.stringify({ id: roleId }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n method: \"POST\",\n signal,\n });\n }\n\n removeParentRole(userId: string, roleId: string, { signal }: SignalParam = {}) {\n return this.#config.v3Request(`users/${userId}/parent-roles/${roleId}`, {\n method: \"DELETE\",\n signal,\n });\n }\n}\n"]}
|
|
@@ -1,40 +1,30 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
|
+
export declare const identityTypeSchema: z.ZodMiniEnum<{
|
|
3
|
+
REGULAR_USER: "REGULAR_USER";
|
|
4
|
+
SERVICE_USER: "SERVICE_USER";
|
|
5
|
+
}>;
|
|
2
6
|
export declare const userPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
|
|
3
|
-
|
|
4
|
-
firstName: z.ZodMiniString<string
|
|
7
|
+
active: z.ZodMiniBoolean<boolean>;
|
|
8
|
+
firstName: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
5
9
|
id: z.ZodMiniString<string>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
EXTERNAL: "EXTERNAL";
|
|
13
|
-
SYSTEM: "SYSTEM";
|
|
14
|
-
}>;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
|
-
status: z.ZodMiniEnum<{
|
|
17
|
-
ACTIVE: "ACTIVE";
|
|
18
|
-
INACTIVE: "INACTIVE";
|
|
19
|
-
}>;
|
|
20
|
-
username: z.ZodMiniString<string>;
|
|
10
|
+
identityType: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
11
|
+
REGULAR_USER: "REGULAR_USER";
|
|
12
|
+
SERVICE_USER: "SERVICE_USER";
|
|
13
|
+
}>>;
|
|
14
|
+
lastName: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
15
|
+
name: z.ZodMiniString<string>;
|
|
21
16
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
17
|
+
email: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
18
|
+
familyName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
19
|
+
givenName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
22
20
|
id: z.ZodMiniString<string>;
|
|
21
|
+
identityType: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
22
|
+
REGULAR_USER: "REGULAR_USER";
|
|
23
|
+
SERVICE_USER: "SERVICE_USER";
|
|
24
|
+
}>>;
|
|
23
25
|
status: z.ZodMiniEnum<{
|
|
24
26
|
ACTIVE: "ACTIVE";
|
|
25
27
|
INACTIVE: "INACTIVE";
|
|
26
28
|
}>;
|
|
27
29
|
username: z.ZodMiniString<string>;
|
|
28
|
-
roles: z.ZodMiniArray<z.ZodMiniObject<{
|
|
29
|
-
id: z.ZodMiniString<string>;
|
|
30
|
-
name: z.ZodMiniString<string>;
|
|
31
|
-
type: z.ZodMiniEnum<{
|
|
32
|
-
INTERNAL: "INTERNAL";
|
|
33
|
-
EXTERNAL: "EXTERNAL";
|
|
34
|
-
SYSTEM: "SYSTEM";
|
|
35
|
-
}>;
|
|
36
|
-
}, z.core.$strip>>;
|
|
37
|
-
email: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
38
|
-
familyName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
39
|
-
givenName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
40
30
|
}, z.core.$strip>>;
|
|
@@ -14,43 +14,43 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import * as z from "zod/mini";
|
|
17
|
+
export const identityTypeSchema = z.enum(["REGULAR_USER", "SERVICE_USER"]);
|
|
17
18
|
const userPropertiesInSchema = z.object({
|
|
18
|
-
|
|
19
|
-
firstName: z.string(),
|
|
19
|
+
active: z.boolean(),
|
|
20
|
+
firstName: z.optional(z.nullable(z.string())),
|
|
20
21
|
id: z.string().check(z.minLength(1)),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
name: z.string(),
|
|
25
|
-
type: z.enum(["INTERNAL", "EXTERNAL", "SYSTEM"]),
|
|
26
|
-
})),
|
|
27
|
-
status: z.enum(["ACTIVE", "INACTIVE"]),
|
|
28
|
-
username: z.string().check(z.trim(), z.minLength(1)),
|
|
22
|
+
identityType: z.optional(identityTypeSchema),
|
|
23
|
+
lastName: z.optional(z.nullable(z.string())),
|
|
24
|
+
name: z.string(),
|
|
29
25
|
});
|
|
30
|
-
export const userPropertiesCodec = z.codec(userPropertiesInSchema, z.
|
|
31
|
-
email:
|
|
32
|
-
firstName: true,
|
|
33
|
-
lastName: true,
|
|
34
|
-
}), {
|
|
35
|
-
email: z.nullable(z.string().check(z.email())),
|
|
26
|
+
export const userPropertiesCodec = z.codec(userPropertiesInSchema, z.object({
|
|
27
|
+
email: z.nullable(z.string()),
|
|
36
28
|
familyName: z.nullable(z.string().check(z.trim())),
|
|
37
29
|
givenName: z.nullable(z.string().check(z.trim())),
|
|
30
|
+
id: z.string().check(z.minLength(1)),
|
|
31
|
+
identityType: z.optional(identityTypeSchema),
|
|
32
|
+
status: z.enum(["ACTIVE", "INACTIVE"]),
|
|
33
|
+
username: z.string().check(z.trim(), z.minLength(1)),
|
|
38
34
|
}), {
|
|
39
35
|
decode(v) {
|
|
40
36
|
return {
|
|
41
|
-
|
|
42
|
-
email: v.email || null,
|
|
37
|
+
email: v.name || null,
|
|
43
38
|
familyName: v.lastName || null,
|
|
44
39
|
givenName: v.firstName || null,
|
|
40
|
+
id: v.id,
|
|
41
|
+
identityType: v.identityType,
|
|
42
|
+
status: v.active ? "ACTIVE" : "INACTIVE",
|
|
43
|
+
username: v.name,
|
|
45
44
|
};
|
|
46
45
|
},
|
|
47
46
|
encode(v) {
|
|
48
|
-
const { email, familyName, givenName, ...rest } = v;
|
|
49
47
|
return {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
active: v.status === "ACTIVE",
|
|
49
|
+
firstName: v.givenName || undefined,
|
|
50
|
+
id: v.id,
|
|
51
|
+
identityType: v.identityType,
|
|
52
|
+
lastName: v.familyName || undefined,
|
|
53
|
+
name: v.username,
|
|
54
54
|
};
|
|
55
55
|
},
|
|
56
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/users/userPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,
|
|
1
|
+
{"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/users/userPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;AAE3E,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,Y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CAAC,EAAE;YACR,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,QAAkB,CAAC,CAAC,CAAE,UAAoB;YAC9D,QAAQ,EAAE,CAAC,CAAC,IAAI;SACjB,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO;YACL,MAAM,EAAE,CAAC,CAAC,MAAM,KAAK,QAAQ;YAC7B,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,SAAS;YACnC,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,QAAQ,EAAE,CAAC,CAAC,UAAU,IAAI,SAAS;YACnC,IAAI,EAAE,CAAC,CAAC,QAAQ;SACjB,CAAC;IACJ,CAAC;CACF,CACF,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\n\nexport const identityTypeSchema = z.enum([\"REGULAR_USER\", \"SERVICE_USER\"]);\n\nconst userPropertiesInSchema = z.object({\n active: z.boolean(),\n firstName: z.optional(z.nullable(z.string())),\n id: z.string().check(z.minLength(1)),\n identityType: z.optional(identityTypeSchema),\n lastName: z.optional(z.nullable(z.string())),\n name: z.string(),\n});\n\nexport const userPropertiesCodec = z.codec(\n userPropertiesInSchema,\n z.object({\n email: z.nullable(z.string()),\n familyName: z.nullable(z.string().check(z.trim())),\n givenName: z.nullable(z.string().check(z.trim())),\n id: z.string().check(z.minLength(1)),\n identityType: z.optional(identityTypeSchema),\n status: z.enum([\"ACTIVE\", \"INACTIVE\"]),\n username: z.string().check(z.trim(), z.minLength(1)),\n }),\n {\n decode(v) {\n return {\n email: v.name || null,\n familyName: v.lastName || null,\n givenName: v.firstName || null,\n id: v.id,\n identityType: v.identityType,\n status: v.active ? (\"ACTIVE\" as const) : (\"INACTIVE\" as const),\n username: v.name,\n };\n },\n encode(v) {\n return {\n active: v.status === \"ACTIVE\",\n firstName: v.givenName || undefined,\n id: v.id,\n identityType: v.identityType,\n lastName: v.familyName || undefined,\n name: v.username,\n };\n },\n },\n);\n"]}
|
|
@@ -91,7 +91,7 @@ export class AgentConversation {
|
|
|
91
91
|
});
|
|
92
92
|
if (attempt.isErr() &&
|
|
93
93
|
isProblem(attempt.error.body) &&
|
|
94
|
-
attempt.error.body.
|
|
94
|
+
attempt.error.body.type === "https://api.dremio.dev/problems/concurrent-modification") {
|
|
95
95
|
const remoteResult = await retrieveConversation(this.#config)(this.id);
|
|
96
96
|
if (remoteResult.isOk()) {
|
|
97
97
|
const remote = new AgentConversation(this.#config, remoteResult.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentConversation.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/conversations/AgentConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;A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AAC,UAAU;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,UAA0E;QAC1F,IAAI,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAC1C,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,YAAY,CAAC;QAC/C,CAAC;QAED,IAAI,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC;QACzC,CAAC;QAED,IAAI,UAAU,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,eAAe,CAAC;QACrD,CAAC;QAED,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACxC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;QAC3C,CAAC;QAED,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC;QAC7B,CAAC;QAED,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;QACjC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,MAAM,CAAC,YAAY,GAAG,wBAAwB,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport { conversationPropertiesCodec } from \"./conversationPropertiesCodec.ts\";\nimport type { SonarV4Config } from \"../../../common/Config.ts\";\nimport { createExchangeRun } from \"./methods/createExchangeRun.ts\";\nimport { deleteConversation } from \"./methods/deleteConversation.ts\";\nimport { conversationUpdateSchema, updateConversation } from \"./methods/updateConversation.ts\";\nimport { map } from \"rxjs\";\nimport { stopExchangeRun } from \"./methods/stopExchangeRun.ts\";\nimport { chatEventCodec } from \"../chat/chatEventSchema.ts\";\nimport { fromTextEventStream } from \"../../../common/fromTextEventStream.ts\";\nimport { streamRunEvents } from \"./methods/streamRunEvents.ts\";\nimport { retrieveConversationHistory } from \"./methods/retrieveConversationHistory.ts\";\nimport type { SignalParam } from \"../../../common/Params.ts\";\nimport { reduceChatEvents } from \"./reduceChatEvents.ts\";\nimport type { ConflictResolver } from \"../../../common/ConflictResolver.ts\";\nimport { AsyncResult } from \"ts-results-es\";\nimport { retrieveConversation } from \"./methods/retrieveConversation.ts\";\nimport { isProblem } from \"../../../common/HttpError.ts\";\nimport type { createConversationCodec } from \"./methods/createConversation.ts\";\n\nexport type AgentConversationProperties = z.output<typeof conversationPropertiesCodec>;\n\n/**\n * Represents a saved conversation with the Dremio AI Agent.\n */\nexport class AgentConversation implements AgentConversationProperties {\n readonly #config: SonarV4Config;\n readonly createdAt: AgentConversationProperties[\"createdAt\"];\n readonly id: AgentConversationProperties[\"id\"];\n #currentRunId: AgentConversationProperties[\"currentRunId\"];\n #modelName: AgentConversationProperties[\"modelName\"];\n #modelProviderId: AgentConversationProperties[\"modelProviderId\"];\n #modifiedAt: AgentConversationProperties[\"modifiedAt\"];\n #tag: string;\n #title: string | null;\n\n constructor(config: SonarV4Config, properties: AgentConversationProperties) {\n this.#config = config;\n this.createdAt = properties.createdAt;\n this.id = properties.id;\n this.#currentRunId = properties.currentRunId;\n this.#modelName = properties.modelName;\n this.#modelProviderId = properties.modelProviderId;\n this.#modifiedAt = properties.modifiedAt;\n this.#tag = properties.tag;\n this.#title = properties.title;\n }\n\n get currentRunId() {\n return this.#currentRunId;\n }\n\n get modelName() {\n return this.#modelName;\n }\n\n get modelProviderId() {\n return this.#modelProviderId;\n }\n\n get modifiedAt() {\n return this.#modifiedAt;\n }\n\n get tag() {\n return this.#tag;\n }\n\n get title() {\n return this.#title;\n }\n\n clone() {\n return new AgentConversation(this.#config, this);\n }\n\n /**\n * Permanently deletes this conversation.\n */\n delete() {\n return deleteConversation(this.#config)(this.id);\n }\n\n /**\n * Patches properties for this `AgentConversation`, mutating instance properties after\n * a successful commit.\n */\n update(\n properties: z.infer<typeof AgentConversation.updateSchema>,\n options: {\n onConflict?: ConflictResolver<\n AgentConversationProperties,\n z.infer<typeof AgentConversation.updateSchema>\n >;\n } = {},\n ) {\n const { onConflict = () => null } = options;\n return new AsyncResult(\n (async () => {\n const attempt = await updateConversation(this.#config)(this.id, this.#tag, properties).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n\n if (\n attempt.isErr() &&\n isProblem(attempt.error.body) &&\n attempt.error.body.title === \"https://api.dremio.dev/problems/concurrent-modification\"\n ) {\n const remoteResult = await retrieveConversation(this.#config)(this.id);\n if (remoteResult.isOk()) {\n const remote = new AgentConversation(this.#config, remoteResult.value);\n const resolved = await onConflict(this.toJSON(), remote.toJSON(), properties);\n if (resolved !== null) {\n return updateConversation(this.#config)(this.id, remote.tag, resolved).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n }\n }\n }\n\n return attempt;\n })(),\n );\n }\n\n history({ signal }: SignalParam = {}) {\n return retrieveConversationHistory(this.#config)(this.id, { signal }).map(\n (response) => response.data,\n );\n }\n\n runEvents$(runId: string) {\n return fromTextEventStream(({ signal }) =>\n streamRunEvents(this.#config)({ conversationId: this.id, runId }, { signal }),\n ).pipe(\n map((event) =>\n z.decode(chatEventCodec, JSON.parse(event.data) as z.input<typeof chatEventCodec>),\n ),\n );\n }\n\n /**\n * Sends a message to the Agent, initiating a new run process.\n * @returns An `AsyncResult` containing the `runId` for the newly created run.\n */\n startRun(properties: z.input<typeof createConversationCodec>) {\n const asyncResult = createExchangeRun(this.#config)(this.id, properties);\n\n asyncResult\n .then((result) => {\n if (result.isOk()) {\n this.#updateProperties(result.value.conversationProperties);\n }\n })\n .catch(() => {});\n\n return asyncResult.map((properties) => properties.currentRunId);\n }\n\n /**\n * Only a single run can be active for a conversation, so for now\n * this method is kept private.\n */\n stopRun(id: string) {\n const asyncResult = stopExchangeRun(this.#config)(this.id, id);\n\n asyncResult\n .then((result) => {\n if (result.isOk() && this.#currentRunId === id) {\n this.#currentRunId = null;\n }\n })\n .catch(() => {});\n\n return asyncResult;\n }\n\n toJSON(): AgentConversationProperties {\n return {\n createdAt: this.createdAt,\n currentRunId: this.currentRunId,\n id: this.id,\n modelName: this.modelName,\n modelProviderId: this.modelProviderId,\n modifiedAt: this.modifiedAt,\n tag: this.tag,\n title: this.title,\n };\n }\n\n #updateProperties(properties: Partial<Omit<AgentConversationProperties, \"createdAt\" | \"id\">>) {\n if (properties.currentRunId !== undefined) {\n this.#currentRunId = properties.currentRunId;\n }\n\n if (properties.modelName !== undefined) {\n this.#modelName = properties.modelName;\n }\n\n if (properties.modelProviderId !== undefined) {\n this.#modelProviderId = properties.modelProviderId;\n }\n\n if (properties.modifiedAt !== undefined) {\n this.#modifiedAt = properties.modifiedAt;\n }\n\n if (properties.tag !== undefined) {\n this.#tag = properties.tag;\n }\n\n if (properties.title !== undefined) {\n this.#title = properties.title;\n }\n }\n\n static reduceChatEvents = reduceChatEvents;\n static updateSchema = conversationUpdateSchema;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AgentConversation.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/conversations/AgentConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAk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GAAG,gBAAgB,CAAC;IAC3C,MAAM,CAAC,YAAY,GAAG,wBAAwB,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport { conversationPropertiesCodec } from \"./conversationPropertiesCodec.ts\";\nimport type { SonarV4Config } from \"../../../common/Config.ts\";\nimport { createExchangeRun } from \"./methods/createExchangeRun.ts\";\nimport { deleteConversation } from \"./methods/deleteConversation.ts\";\nimport { conversationUpdateSchema, updateConversation } from \"./methods/updateConversation.ts\";\nimport { map } from \"rxjs\";\nimport { stopExchangeRun } from \"./methods/stopExchangeRun.ts\";\nimport { chatEventCodec } from \"../chat/chatEventSchema.ts\";\nimport { fromTextEventStream } from \"../../../common/fromTextEventStream.ts\";\nimport { streamRunEvents } from \"./methods/streamRunEvents.ts\";\nimport { retrieveConversationHistory } from \"./methods/retrieveConversationHistory.ts\";\nimport type { SignalParam } from \"../../../common/Params.ts\";\nimport { reduceChatEvents } from \"./reduceChatEvents.ts\";\nimport type { ConflictResolver } from \"../../../common/ConflictResolver.ts\";\nimport { AsyncResult } from \"ts-results-es\";\nimport { retrieveConversation } from \"./methods/retrieveConversation.ts\";\nimport { isProblem } from \"../../../common/HttpError.ts\";\nimport type { createConversationCodec } from \"./methods/createConversation.ts\";\n\nexport type AgentConversationProperties = z.output<typeof conversationPropertiesCodec>;\n\n/**\n * Represents a saved conversation with the Dremio AI Agent.\n */\nexport class AgentConversation implements AgentConversationProperties {\n readonly #config: SonarV4Config;\n readonly createdAt: AgentConversationProperties[\"createdAt\"];\n readonly id: AgentConversationProperties[\"id\"];\n #currentRunId: AgentConversationProperties[\"currentRunId\"];\n #modelName: AgentConversationProperties[\"modelName\"];\n #modelProviderId: AgentConversationProperties[\"modelProviderId\"];\n #modifiedAt: AgentConversationProperties[\"modifiedAt\"];\n #tag: string;\n #title: string | null;\n\n constructor(config: SonarV4Config, properties: AgentConversationProperties) {\n this.#config = config;\n this.createdAt = properties.createdAt;\n this.id = properties.id;\n this.#currentRunId = properties.currentRunId;\n this.#modelName = properties.modelName;\n this.#modelProviderId = properties.modelProviderId;\n this.#modifiedAt = properties.modifiedAt;\n this.#tag = properties.tag;\n this.#title = properties.title;\n }\n\n get currentRunId() {\n return this.#currentRunId;\n }\n\n get modelName() {\n return this.#modelName;\n }\n\n get modelProviderId() {\n return this.#modelProviderId;\n }\n\n get modifiedAt() {\n return this.#modifiedAt;\n }\n\n get tag() {\n return this.#tag;\n }\n\n get title() {\n return this.#title;\n }\n\n clone() {\n return new AgentConversation(this.#config, this);\n }\n\n /**\n * Permanently deletes this conversation.\n */\n delete() {\n return deleteConversation(this.#config)(this.id);\n }\n\n /**\n * Patches properties for this `AgentConversation`, mutating instance properties after\n * a successful commit.\n */\n update(\n properties: z.infer<typeof AgentConversation.updateSchema>,\n options: {\n onConflict?: ConflictResolver<\n AgentConversationProperties,\n z.infer<typeof AgentConversation.updateSchema>\n >;\n } = {},\n ) {\n const { onConflict = () => null } = options;\n return new AsyncResult(\n (async () => {\n const attempt = await updateConversation(this.#config)(this.id, this.#tag, properties).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n\n if (\n attempt.isErr() &&\n isProblem(attempt.error.body) &&\n attempt.error.body.type === \"https://api.dremio.dev/problems/concurrent-modification\"\n ) {\n const remoteResult = await retrieveConversation(this.#config)(this.id);\n if (remoteResult.isOk()) {\n const remote = new AgentConversation(this.#config, remoteResult.value);\n const resolved = await onConflict(this.toJSON(), remote.toJSON(), properties);\n if (resolved !== null) {\n return updateConversation(this.#config)(this.id, remote.tag, resolved).map(\n (properties) => {\n this.#updateProperties(properties);\n },\n );\n }\n }\n }\n\n return attempt;\n })(),\n );\n }\n\n history({ signal }: SignalParam = {}) {\n return retrieveConversationHistory(this.#config)(this.id, { signal }).map(\n (response) => response.data,\n );\n }\n\n runEvents$(runId: string) {\n return fromTextEventStream(({ signal }) =>\n streamRunEvents(this.#config)({ conversationId: this.id, runId }, { signal }),\n ).pipe(\n map((event) =>\n z.decode(chatEventCodec, JSON.parse(event.data) as z.input<typeof chatEventCodec>),\n ),\n );\n }\n\n /**\n * Sends a message to the Agent, initiating a new run process.\n * @returns An `AsyncResult` containing the `runId` for the newly created run.\n */\n startRun(properties: z.input<typeof createConversationCodec>) {\n const asyncResult = createExchangeRun(this.#config)(this.id, properties);\n\n asyncResult\n .then((result) => {\n if (result.isOk()) {\n this.#updateProperties(result.value.conversationProperties);\n }\n })\n .catch(() => {});\n\n return asyncResult.map((properties) => properties.currentRunId);\n }\n\n /**\n * Only a single run can be active for a conversation, so for now\n * this method is kept private.\n */\n stopRun(id: string) {\n const asyncResult = stopExchangeRun(this.#config)(this.id, id);\n\n asyncResult\n .then((result) => {\n if (result.isOk() && this.#currentRunId === id) {\n this.#currentRunId = null;\n }\n })\n .catch(() => {});\n\n return asyncResult;\n }\n\n toJSON(): AgentConversationProperties {\n return {\n createdAt: this.createdAt,\n currentRunId: this.currentRunId,\n id: this.id,\n modelName: this.modelName,\n modelProviderId: this.modelProviderId,\n modifiedAt: this.modifiedAt,\n tag: this.tag,\n title: this.title,\n };\n }\n\n #updateProperties(properties: Partial<Omit<AgentConversationProperties, \"createdAt\" | \"id\">>) {\n if (properties.currentRunId !== undefined) {\n this.#currentRunId = properties.currentRunId;\n }\n\n if (properties.modelName !== undefined) {\n this.#modelName = properties.modelName;\n }\n\n if (properties.modelProviderId !== undefined) {\n this.#modelProviderId = properties.modelProviderId;\n }\n\n if (properties.modifiedAt !== undefined) {\n this.#modifiedAt = properties.modifiedAt;\n }\n\n if (properties.tag !== undefined) {\n this.#tag = properties.tag;\n }\n\n if (properties.title !== undefined) {\n this.#title = properties.title;\n }\n }\n\n static reduceChatEvents = reduceChatEvents;\n static updateSchema = conversationUpdateSchema;\n}\n"]}
|
package/dist-iife/cloud.js
CHANGED
|
@@ -8224,7 +8224,6 @@ var DremioCloud = (() => {
|
|
|
8224
8224
|
|
|
8225
8225
|
// node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/regexes.js
|
|
8226
8226
|
var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
8227
|
-
var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
8228
8227
|
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
8229
8228
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
8230
8229
|
function timeSource(args) {
|
|
@@ -8621,10 +8620,6 @@ var DremioCloud = (() => {
|
|
|
8621
8620
|
$ZodCheckStringFormat.init(inst, def);
|
|
8622
8621
|
$ZodString.init(inst, def);
|
|
8623
8622
|
});
|
|
8624
|
-
var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
8625
|
-
def.pattern ?? (def.pattern = email);
|
|
8626
|
-
$ZodStringFormat.init(inst, def);
|
|
8627
|
-
});
|
|
8628
8623
|
var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
8629
8624
|
def.pattern ?? (def.pattern = datetime(def));
|
|
8630
8625
|
$ZodStringFormat.init(inst, def);
|
|
@@ -9344,15 +9339,6 @@ var DremioCloud = (() => {
|
|
|
9344
9339
|
...normalizeParams(params)
|
|
9345
9340
|
});
|
|
9346
9341
|
}
|
|
9347
|
-
function _email(Class2, params) {
|
|
9348
|
-
return new Class2({
|
|
9349
|
-
type: "string",
|
|
9350
|
-
format: "email",
|
|
9351
|
-
check: "string_format",
|
|
9352
|
-
abort: false,
|
|
9353
|
-
...normalizeParams(params)
|
|
9354
|
-
});
|
|
9355
|
-
}
|
|
9356
9342
|
function _isoDateTime(Class2, params) {
|
|
9357
9343
|
return new Class2({
|
|
9358
9344
|
type: "string",
|
|
@@ -9543,13 +9529,6 @@ var DremioCloud = (() => {
|
|
|
9543
9529
|
$ZodStringFormat.init(inst, def);
|
|
9544
9530
|
ZodMiniString.init(inst, def);
|
|
9545
9531
|
});
|
|
9546
|
-
var ZodMiniEmail = /* @__PURE__ */ $constructor("ZodMiniEmail", (inst, def) => {
|
|
9547
|
-
$ZodEmail.init(inst, def);
|
|
9548
|
-
ZodMiniStringFormat.init(inst, def);
|
|
9549
|
-
});
|
|
9550
|
-
function email2(params) {
|
|
9551
|
-
return _email(ZodMiniEmail, params);
|
|
9552
|
-
}
|
|
9553
9532
|
var ZodMiniNumber = /* @__PURE__ */ $constructor("ZodMiniNumber", (inst, def) => {
|
|
9554
9533
|
$ZodNumber.init(inst, def);
|
|
9555
9534
|
ZodMiniType.init(inst, def);
|
|
@@ -13359,7 +13338,7 @@ var DremioCloud = (() => {
|
|
|
13359
13338
|
var CloudUser = class extends EnterpriseUser {
|
|
13360
13339
|
};
|
|
13361
13340
|
var cloudUserEntityToProperties = (entity) => ({
|
|
13362
|
-
email: entity.
|
|
13341
|
+
email: entity.name,
|
|
13363
13342
|
familyName: entity.lastName || null,
|
|
13364
13343
|
givenName: entity.firstName || null,
|
|
13365
13344
|
id: entity.id,
|
|
@@ -13388,8 +13367,8 @@ var DremioCloud = (() => {
|
|
|
13388
13367
|
/**
|
|
13389
13368
|
* @deprecated
|
|
13390
13369
|
*/
|
|
13391
|
-
retrieveByEmail(
|
|
13392
|
-
return this.#config.sonarV3Request(`user/by-name/${
|
|
13370
|
+
retrieveByEmail(email2, { signal } = {}) {
|
|
13371
|
+
return this.#config.sonarV3Request(`user/by-name/${email2}`, { signal }).map((res) => res.json()).map((entity) => this._userFromEntity(entity)).promise;
|
|
13393
13372
|
}
|
|
13394
13373
|
};
|
|
13395
13374
|
|
|
@@ -14090,43 +14069,43 @@ var DremioCloud = (() => {
|
|
|
14090
14069
|
};
|
|
14091
14070
|
|
|
14092
14071
|
// dist/cloud/users/userPropertiesCodec.js
|
|
14072
|
+
var identityTypeSchema = _enum(["REGULAR_USER", "SERVICE_USER"]);
|
|
14093
14073
|
var userPropertiesInSchema = object({
|
|
14094
|
-
|
|
14095
|
-
firstName: string2(),
|
|
14074
|
+
active: boolean2(),
|
|
14075
|
+
firstName: optional(nullable(string2())),
|
|
14096
14076
|
id: string2().check(_minLength(1)),
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
name: string2(),
|
|
14101
|
-
type: _enum(["INTERNAL", "EXTERNAL", "SYSTEM"])
|
|
14102
|
-
})),
|
|
14103
|
-
status: _enum(["ACTIVE", "INACTIVE"]),
|
|
14104
|
-
username: string2().check(_trim(), _minLength(1))
|
|
14077
|
+
identityType: optional(identityTypeSchema),
|
|
14078
|
+
lastName: optional(nullable(string2())),
|
|
14079
|
+
name: string2()
|
|
14105
14080
|
});
|
|
14106
|
-
var userPropertiesCodec = codec(userPropertiesInSchema,
|
|
14107
|
-
email:
|
|
14108
|
-
firstName: true,
|
|
14109
|
-
lastName: true
|
|
14110
|
-
}), {
|
|
14111
|
-
email: nullable(string2().check(email2())),
|
|
14081
|
+
var userPropertiesCodec = codec(userPropertiesInSchema, object({
|
|
14082
|
+
email: nullable(string2()),
|
|
14112
14083
|
familyName: nullable(string2().check(_trim())),
|
|
14113
|
-
givenName: nullable(string2().check(_trim()))
|
|
14084
|
+
givenName: nullable(string2().check(_trim())),
|
|
14085
|
+
id: string2().check(_minLength(1)),
|
|
14086
|
+
identityType: optional(identityTypeSchema),
|
|
14087
|
+
status: _enum(["ACTIVE", "INACTIVE"]),
|
|
14088
|
+
username: string2().check(_trim(), _minLength(1))
|
|
14114
14089
|
}), {
|
|
14115
14090
|
decode(v2) {
|
|
14116
14091
|
return {
|
|
14117
|
-
|
|
14118
|
-
email: v2.email || null,
|
|
14092
|
+
email: v2.name || null,
|
|
14119
14093
|
familyName: v2.lastName || null,
|
|
14120
|
-
givenName: v2.firstName || null
|
|
14094
|
+
givenName: v2.firstName || null,
|
|
14095
|
+
id: v2.id,
|
|
14096
|
+
identityType: v2.identityType,
|
|
14097
|
+
status: v2.active ? "ACTIVE" : "INACTIVE",
|
|
14098
|
+
username: v2.name
|
|
14121
14099
|
};
|
|
14122
14100
|
},
|
|
14123
14101
|
encode(v2) {
|
|
14124
|
-
const { email: email3, familyName, givenName, ...rest } = v2;
|
|
14125
14102
|
return {
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14103
|
+
active: v2.status === "ACTIVE",
|
|
14104
|
+
firstName: v2.givenName || void 0,
|
|
14105
|
+
id: v2.id,
|
|
14106
|
+
identityType: v2.identityType,
|
|
14107
|
+
lastName: v2.familyName || void 0,
|
|
14108
|
+
name: v2.username
|
|
14130
14109
|
};
|
|
14131
14110
|
}
|
|
14132
14111
|
});
|
|
@@ -14139,7 +14118,7 @@ var DremioCloud = (() => {
|
|
|
14139
14118
|
familyName;
|
|
14140
14119
|
givenName;
|
|
14141
14120
|
id;
|
|
14142
|
-
|
|
14121
|
+
identityType;
|
|
14143
14122
|
status;
|
|
14144
14123
|
username;
|
|
14145
14124
|
constructor(config3, properties) {
|
|
@@ -14148,7 +14127,7 @@ var DremioCloud = (() => {
|
|
|
14148
14127
|
this.familyName = properties.familyName;
|
|
14149
14128
|
this.givenName = properties.givenName;
|
|
14150
14129
|
this.id = properties.id;
|
|
14151
|
-
this.
|
|
14130
|
+
this.identityType = properties.identityType;
|
|
14152
14131
|
this.status = properties.status;
|
|
14153
14132
|
this.username = properties.username;
|
|
14154
14133
|
}
|
|
@@ -14178,59 +14157,113 @@ var DremioCloud = (() => {
|
|
|
14178
14157
|
constructor(config3) {
|
|
14179
14158
|
this.#config = config3;
|
|
14180
14159
|
}
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14160
|
+
list(params) {
|
|
14161
|
+
const buildQuery = (extra) => {
|
|
14162
|
+
const query = new URLSearchParams();
|
|
14163
|
+
if (params?.filter)
|
|
14164
|
+
query.set("filter", params.filter);
|
|
14165
|
+
if (params?.maxResults)
|
|
14166
|
+
query.set("maxResults", String(params.maxResults));
|
|
14167
|
+
if (params?.orderBy)
|
|
14168
|
+
query.set("orderBy", params.orderBy);
|
|
14169
|
+
if (extra?.pageToken)
|
|
14170
|
+
query.set("pageToken", extra.pageToken);
|
|
14171
|
+
return query;
|
|
14172
|
+
};
|
|
14173
|
+
const getPage = ({ pageToken, signal } = {}) => this.#config.v3Request(`users?${buildQuery({ pageToken })}`, {
|
|
14174
|
+
headers: { Accept: "application/json" },
|
|
14175
|
+
signal
|
|
14176
|
+
}).map((res) => res.json()).map((page) => ({
|
|
14190
14177
|
...page,
|
|
14191
14178
|
data: page.data.map((entity) => new User2(this.#config, decode(userPropertiesCodec, entity)))
|
|
14192
14179
|
}));
|
|
14193
14180
|
return {
|
|
14194
14181
|
async *data({ signal } = {}) {
|
|
14195
|
-
const
|
|
14196
|
-
let offset = 0;
|
|
14197
|
-
const firstPageResult = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise;
|
|
14182
|
+
const firstPageResult = await getPage({ signal }).promise;
|
|
14198
14183
|
if (firstPageResult.isErr()) {
|
|
14199
14184
|
throw firstPageResult.error;
|
|
14200
14185
|
}
|
|
14201
14186
|
let currentPage = firstPageResult.value;
|
|
14202
14187
|
yield* currentPage.data;
|
|
14203
|
-
while (currentPage.
|
|
14204
|
-
|
|
14205
|
-
|
|
14188
|
+
while (currentPage.nextPageToken) {
|
|
14189
|
+
currentPage = await getPage({
|
|
14190
|
+
pageToken: currentPage.nextPageToken,
|
|
14191
|
+
signal
|
|
14192
|
+
}).promise.then((result) => result.unwrap());
|
|
14206
14193
|
yield* currentPage.data;
|
|
14207
14194
|
}
|
|
14208
14195
|
},
|
|
14209
14196
|
getPage
|
|
14210
14197
|
};
|
|
14211
14198
|
}
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
_retrieveById(id, { signal } = {}) {
|
|
14216
|
-
return this.#config.v2Request(`user/${id}`, {
|
|
14199
|
+
create(params, { signal } = {}) {
|
|
14200
|
+
return this.#config.v3Request("users", {
|
|
14201
|
+
body: JSON.stringify(params),
|
|
14217
14202
|
headers: {
|
|
14218
|
-
Accept: "application/json"
|
|
14203
|
+
Accept: "application/json",
|
|
14204
|
+
"Content-Type": "application/json"
|
|
14219
14205
|
},
|
|
14206
|
+
method: "POST",
|
|
14220
14207
|
signal
|
|
14221
14208
|
}).map((res) => res.json()).map((entity) => new User2(this.#config, decode(userPropertiesCodec, entity)));
|
|
14222
14209
|
}
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14210
|
+
retrieveById(id, { signal } = {}) {
|
|
14211
|
+
return this.#config.v3Request(`users/${id}`, {
|
|
14212
|
+
headers: { Accept: "application/json" },
|
|
14213
|
+
signal
|
|
14214
|
+
}).map((res) => res.json()).map((entity) => new User2(this.#config, decode(userPropertiesCodec, entity)));
|
|
14215
|
+
}
|
|
14216
|
+
retrieveByName(name, { signal } = {}) {
|
|
14217
|
+
return this.#config.v3Request(`users/names/${name}`, {
|
|
14218
|
+
headers: { Accept: "application/json" },
|
|
14219
|
+
signal
|
|
14220
|
+
}).map((res) => res.json()).map((entity) => new User2(this.#config, decode(userPropertiesCodec, entity)));
|
|
14221
|
+
}
|
|
14222
|
+
update(id, params, { signal } = {}) {
|
|
14223
|
+
return this.#config.v3Request(`users/${id}`, {
|
|
14224
|
+
body: JSON.stringify(params),
|
|
14228
14225
|
headers: {
|
|
14229
|
-
Accept: "application/json"
|
|
14226
|
+
Accept: "application/json",
|
|
14227
|
+
"Content-Type": "application/json"
|
|
14230
14228
|
},
|
|
14229
|
+
method: "PUT",
|
|
14231
14230
|
signal
|
|
14232
14231
|
}).map((res) => res.json()).map((entity) => new User2(this.#config, decode(userPropertiesCodec, entity)));
|
|
14233
14232
|
}
|
|
14233
|
+
delete(id, { signal } = {}) {
|
|
14234
|
+
return this.#config.v3Request(`users/${id}`, {
|
|
14235
|
+
method: "DELETE",
|
|
14236
|
+
signal
|
|
14237
|
+
});
|
|
14238
|
+
}
|
|
14239
|
+
listParentRoles(userId, params, { signal } = {}) {
|
|
14240
|
+
const query = new URLSearchParams();
|
|
14241
|
+
if (params?.maxResults)
|
|
14242
|
+
query.set("maxResults", String(params.maxResults));
|
|
14243
|
+
if (params?.pageToken)
|
|
14244
|
+
query.set("pageToken", params.pageToken);
|
|
14245
|
+
return this.#config.v3Request(`users/${userId}/parent-roles?${query}`, {
|
|
14246
|
+
headers: { Accept: "application/json" },
|
|
14247
|
+
signal
|
|
14248
|
+
});
|
|
14249
|
+
}
|
|
14250
|
+
addParentRole(userId, roleId, { signal } = {}) {
|
|
14251
|
+
return this.#config.v3Request(`users/${userId}/parent-roles`, {
|
|
14252
|
+
body: JSON.stringify({ id: roleId }),
|
|
14253
|
+
headers: {
|
|
14254
|
+
Accept: "application/json",
|
|
14255
|
+
"Content-Type": "application/json"
|
|
14256
|
+
},
|
|
14257
|
+
method: "POST",
|
|
14258
|
+
signal
|
|
14259
|
+
});
|
|
14260
|
+
}
|
|
14261
|
+
removeParentRole(userId, roleId, { signal } = {}) {
|
|
14262
|
+
return this.#config.v3Request(`users/${userId}/parent-roles/${roleId}`, {
|
|
14263
|
+
method: "DELETE",
|
|
14264
|
+
signal
|
|
14265
|
+
});
|
|
14266
|
+
}
|
|
14234
14267
|
};
|
|
14235
14268
|
|
|
14236
14269
|
// dist/cloud/engineRules/EngineRule.js
|
|
@@ -17190,7 +17223,7 @@ var DremioCloud = (() => {
|
|
|
17190
17223
|
const attempt = await updateConversation(this.#config)(this.id, this.#tag, properties).map((properties2) => {
|
|
17191
17224
|
this.#updateProperties(properties2);
|
|
17192
17225
|
});
|
|
17193
|
-
if (attempt.isErr() && isProblem(attempt.error.body) && attempt.error.body.
|
|
17226
|
+
if (attempt.isErr() && isProblem(attempt.error.body) && attempt.error.body.type === "https://api.dremio.dev/problems/concurrent-modification") {
|
|
17194
17227
|
const remoteResult = await retrieveConversation(this.#config)(this.id);
|
|
17195
17228
|
if (remoteResult.isOk()) {
|
|
17196
17229
|
const remote = new _AgentConversation(this.#config, remoteResult.value);
|
package/dist-iife/enterprise.js
CHANGED
|
@@ -17931,7 +17931,7 @@ var DremioEnterprise = (() => {
|
|
|
17931
17931
|
const attempt = await updateConversation(this.#config)(this.id, this.#tag, properties).map((properties2) => {
|
|
17932
17932
|
this.#updateProperties(properties2);
|
|
17933
17933
|
});
|
|
17934
|
-
if (attempt.isErr() && isProblem(attempt.error.body) && attempt.error.body.
|
|
17934
|
+
if (attempt.isErr() && isProblem(attempt.error.body) && attempt.error.body.type === "https://api.dremio.dev/problems/concurrent-modification") {
|
|
17935
17935
|
const remoteResult = await retrieveConversation(this.#config)(this.id);
|
|
17936
17936
|
if (remoteResult.isOk()) {
|
|
17937
17937
|
const remote = new _AgentConversation(this.#config, remoteResult.value);
|