@dremio/js-sdk 0.46.1 → 0.48.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/catalog/EnterpriseCatalogResource.d.ts +2 -2
- package/dist/cloud/catalog/EnterpriseCatalogResource.js.map +1 -1
- 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/enterprise/catalog/EnterpriseCatalogResource.d.ts +2 -2
- package/dist/enterprise/catalog/EnterpriseCatalogResource.js.map +1 -1
- package/dist/enterprise/catalog/catalogRetrieve.d.ts +3 -3
- package/dist/enterprise/catalog/catalogRetrieve.js +111 -91
- package/dist/enterprise/catalog/catalogRetrieve.js.map +1 -1
- package/dist-iife/cloud.js +3601 -1577
- package/dist-iife/enterprise.js +8087 -8072
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncResult } from "ts-results-es";
|
|
2
|
-
import type { SonarV2Config, SonarV3Config, XHRConfig } from "../../common/Config.ts";
|
|
2
|
+
import type { SonarV2Config, SonarV3Config, V3Config, XHRConfig } from "../../common/Config.ts";
|
|
3
3
|
import type { SignalParam } from "../../common/Params.ts";
|
|
4
4
|
import { baseRetrieve, baseRetrieveByPath } from "../../enterprise/catalog/catalogRetrieve.js";
|
|
5
5
|
import type { CatalogSearchParams } from "../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts";
|
|
@@ -10,7 +10,7 @@ export declare class EnterpriseCatalogResource {
|
|
|
10
10
|
#private;
|
|
11
11
|
retrieve: ReturnType<typeof baseRetrieve>;
|
|
12
12
|
retrieveByPath: ReturnType<typeof baseRetrieveByPath>;
|
|
13
|
-
constructor(config: SonarV2Config & SonarV3Config & XHRConfig);
|
|
13
|
+
constructor(config: SonarV2Config & SonarV3Config & XHRConfig & V3Config);
|
|
14
14
|
list(): {
|
|
15
15
|
data(): AsyncGenerator<EnterpriseFunctionCatalogReference | EnterpriseHomeCatalogReference | EnterpriseSourceCatalogReference | EnterpriseSpaceCatalogReference, void, unknown>;
|
|
16
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/cloud/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,iFAAiF,CAAC;AAOrI,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,OAAO,yBAAyB;IACpC,OAAO,CAA4C;IACnD,cAAc,CAAyC;IAEvD,QAAQ,CAAkC;IAC1C,cAAc,CAAwC;IAEtD,YAAY,MAAiD;QAC3D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,cA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C;oBACzC,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;oBACnF,IAAI,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC;wBAC3B,MAAM,cAAc,CAAC,KAAK,CAAC;oBAC7B,CAAC;oBACD,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC;oBACtC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;oBACrB,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC;gBACzC,CAAC;YACH,CAAC;YACD,OAAO;SACR,CAAC;IACJ,CAAC;IAED,2BAA2B,CAAC,MAAe;QACzC,OAAO,8BAA8B,CACnC,kCAAkC,CAAC,MAAM,CAAC,EAC1C,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,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 { AsyncResult } from \"ts-results-es\";\nimport type { SonarV2Config, SonarV3Config, XHRConfig } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { catalogReferenceFromProperties } from \"../../enterprise/catalog/catalogReferenceFromProperties.ts\";\nimport { baseRetrieve, baseRetrieveByPath } from \"../../enterprise/catalog/catalogRetrieve.js\";\nimport type { CatalogSearchParams } from \"../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts\";\nimport { createCatalogSearch } from \"../../enterprise/catalog/catalogSearch/createCatalogSearch.js\";\nimport { catalogReferenceEntityToProperties } from \"../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.ts\";\nimport type {\n EnterpriseFunctionCatalogReference,\n EnterpriseHomeCatalogReference,\n EnterpriseSourceCatalogReference,\n EnterpriseSpaceCatalogReference,\n} from \"../interfaces.ts\";\nimport { FileUpload, uploadExtensionSchema } from \"./FileUpload.ts\";\nimport * as z from \"zod/mini\";\n\nexport class EnterpriseCatalogResource {\n #config: SonarV2Config & SonarV3Config & XHRConfig;\n #catalogSearch: ReturnType<typeof createCatalogSearch>;\n\n retrieve: ReturnType<typeof baseRetrieve>;\n retrieveByPath: ReturnType<typeof baseRetrieveByPath>;\n\n constructor(config: SonarV2Config & SonarV3Config & XHRConfig) {\n this.#config = config;\n this.retrieve = baseRetrieve(config);\n this.retrieveByPath = baseRetrieveByPath(config);\n this.#catalogSearch = createCatalogSearch(\n this.#config,\n this._catalogReferenceFromEntity.bind(this),\n );\n }\n\n list() {\n const getRoot = () =>\n this.#config\n .sonarV3Request(\"catalog\")\n .map((res) => res.json() as Promise<{ data: unknown[] }>)\n .map((response) =>\n response.data.map(\n (entity: unknown) =>\n catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n ) as\n | EnterpriseFunctionCatalogReference\n | EnterpriseHomeCatalogReference\n | EnterpriseSourceCatalogReference\n | EnterpriseSpaceCatalogReference,\n ),\n )\n .promise.then((result) => result.unwrap());\n return {\n async *data() {\n yield* await getRoot();\n },\n };\n }\n\n copyFromObjectStore({\n extension,\n path,\n sourceName,\n }: {\n extension: z.infer<typeof uploadExtensionSchema>;\n path: string[];\n sourceName: string;\n }) {\n return this.#config\n .sonarV3Request(`uploads/${sourceName}`, {\n body: JSON.stringify({\n extension,\n pathComponents: path,\n }),\n headers: {\n Accept: \"text/plain\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.text())\n .map((id) => new FileUpload(this.#config, id));\n }\n\n upload(fileStream: ReadableStream, extension: z.infer<typeof uploadExtensionSchema>) {\n return new AsyncResult(\n (async () => {\n const body = new FormData();\n body.set(\"file\", await new Response(fileStream).blob());\n body.set(\"extension\", extension);\n\n return this.#config\n .sonarV3Request(\"uploads\", {\n body,\n headers: {\n Accept: \"text/plain\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.text())\n .map((id) => new FileUpload(this.#config, id)).promise;\n })(),\n );\n }\n\n uploadXHR(\n file: Blob,\n extension: z.infer<typeof uploadExtensionSchema>,\n options: { onProgress?: (e: ProgressEvent<XMLHttpRequestEventTarget>) => void } = {},\n ) {\n const body = new FormData();\n body.set(\"file\", file);\n body.set(\"extension\", extension);\n return this.#config\n .xhr(\n \"POST\",\n this.#config.sonarV3URL(\"uploads\").toString(),\n { Accept: \"text/plain\" },\n body,\n (xhr) => {\n if (typeof options.onProgress === \"function\") {\n xhr.upload.addEventListener(\"progress\", options.onProgress);\n }\n },\n )\n .map((xhr) => {\n if (typeof options.onProgress === \"function\") {\n xhr.upload.removeEventListener(\"progress\", options.onProgress);\n }\n return new FileUpload(this.#config, xhr.responseText);\n });\n }\n\n search(params: CatalogSearchParams) {\n const getPage = ({ pageParam, signal }: { pageParam?: string } & SignalParam = {}) =>\n this.#catalogSearch(params, { pageParam, signal });\n return {\n async *data({ signal }: SignalParam = {}) {\n const firstPageResult = await getPage({ signal }).promise;\n if (firstPageResult.isErr()) {\n throw firstPageResult.error;\n }\n const firstPage = firstPageResult.value;\n yield* firstPage.data;\n let nextPageToken = firstPage.nextPageToken;\n while (nextPageToken && !signal?.aborted) {\n const nextPageResult = await getPage({ pageParam: nextPageToken, signal }).promise;\n if (nextPageResult.isErr()) {\n throw nextPageResult.error;\n }\n const nextPage = nextPageResult.value;\n yield* nextPage.data;\n nextPageToken = nextPage.nextPageToken;\n }\n },\n getPage,\n };\n }\n\n _catalogReferenceFromEntity(entity: unknown) {\n return catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/cloud/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,iFAAiF,CAAC;AAOrI,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,OAAO,yBAAyB;IACpC,OAAO,CAA4C;IACnD,cAAc,CAAyC;IAEvD,QAAQ,CAAkC;IAC1C,cAAc,CAAwC;IAEtD,YAAY,MAA4D;QACtE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,cAAc,GAAG,mBAAmB,CACvC,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAC5C,CAAC;IACJ,CAAC;IAED,IAAI;QACF,MAAM,OAAO,GAAG,GAAG,EAAE,CACnB,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,SAAS,CAAC;aACzB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAkC,CAAC;aACxD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAChB,QAAQ,CAAC,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B,CAAC,MAAe;QACzC,OAAO,8BAA8B,CACnC,kCAAkC,CAAC,MAAM,CAAC,EAC1C,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,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 { AsyncResult } from \"ts-results-es\";\nimport type { SonarV2Config, SonarV3Config, V3Config, XHRConfig } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { catalogReferenceFromProperties } from \"../../enterprise/catalog/catalogReferenceFromProperties.ts\";\nimport { baseRetrieve, baseRetrieveByPath } from \"../../enterprise/catalog/catalogRetrieve.js\";\nimport type { CatalogSearchParams } from \"../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts\";\nimport { createCatalogSearch } from \"../../enterprise/catalog/catalogSearch/createCatalogSearch.js\";\nimport { catalogReferenceEntityToProperties } from \"../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.ts\";\nimport type {\n EnterpriseFunctionCatalogReference,\n EnterpriseHomeCatalogReference,\n EnterpriseSourceCatalogReference,\n EnterpriseSpaceCatalogReference,\n} from \"../interfaces.ts\";\nimport { FileUpload, uploadExtensionSchema } from \"./FileUpload.ts\";\nimport * as z from \"zod/mini\";\n\nexport class EnterpriseCatalogResource {\n #config: SonarV2Config & SonarV3Config & XHRConfig;\n #catalogSearch: ReturnType<typeof createCatalogSearch>;\n\n retrieve: ReturnType<typeof baseRetrieve>;\n retrieveByPath: ReturnType<typeof baseRetrieveByPath>;\n\n constructor(config: SonarV2Config & SonarV3Config & XHRConfig & V3Config) {\n this.#config = config;\n this.retrieve = baseRetrieve(config);\n this.retrieveByPath = baseRetrieveByPath(config);\n this.#catalogSearch = createCatalogSearch(\n this.#config,\n this._catalogReferenceFromEntity.bind(this),\n );\n }\n\n list() {\n const getRoot = () =>\n this.#config\n .sonarV3Request(\"catalog\")\n .map((res) => res.json() as Promise<{ data: unknown[] }>)\n .map((response) =>\n response.data.map(\n (entity: unknown) =>\n catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n ) as\n | EnterpriseFunctionCatalogReference\n | EnterpriseHomeCatalogReference\n | EnterpriseSourceCatalogReference\n | EnterpriseSpaceCatalogReference,\n ),\n )\n .promise.then((result) => result.unwrap());\n return {\n async *data() {\n yield* await getRoot();\n },\n };\n }\n\n copyFromObjectStore({\n extension,\n path,\n sourceName,\n }: {\n extension: z.infer<typeof uploadExtensionSchema>;\n path: string[];\n sourceName: string;\n }) {\n return this.#config\n .sonarV3Request(`uploads/${sourceName}`, {\n body: JSON.stringify({\n extension,\n pathComponents: path,\n }),\n headers: {\n Accept: \"text/plain\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.text())\n .map((id) => new FileUpload(this.#config, id));\n }\n\n upload(fileStream: ReadableStream, extension: z.infer<typeof uploadExtensionSchema>) {\n return new AsyncResult(\n (async () => {\n const body = new FormData();\n body.set(\"file\", await new Response(fileStream).blob());\n body.set(\"extension\", extension);\n\n return this.#config\n .sonarV3Request(\"uploads\", {\n body,\n headers: {\n Accept: \"text/plain\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.text())\n .map((id) => new FileUpload(this.#config, id)).promise;\n })(),\n );\n }\n\n uploadXHR(\n file: Blob,\n extension: z.infer<typeof uploadExtensionSchema>,\n options: { onProgress?: (e: ProgressEvent<XMLHttpRequestEventTarget>) => void } = {},\n ) {\n const body = new FormData();\n body.set(\"file\", file);\n body.set(\"extension\", extension);\n return this.#config\n .xhr(\n \"POST\",\n this.#config.sonarV3URL(\"uploads\").toString(),\n { Accept: \"text/plain\" },\n body,\n (xhr) => {\n if (typeof options.onProgress === \"function\") {\n xhr.upload.addEventListener(\"progress\", options.onProgress);\n }\n },\n )\n .map((xhr) => {\n if (typeof options.onProgress === \"function\") {\n xhr.upload.removeEventListener(\"progress\", options.onProgress);\n }\n return new FileUpload(this.#config, xhr.responseText);\n });\n }\n\n search(params: CatalogSearchParams) {\n const getPage = ({ pageParam, signal }: { pageParam?: string } & SignalParam = {}) =>\n this.#catalogSearch(params, { pageParam, signal });\n return {\n async *data({ signal }: SignalParam = {}) {\n const firstPageResult = await getPage({ signal }).promise;\n if (firstPageResult.isErr()) {\n throw firstPageResult.error;\n }\n const firstPage = firstPageResult.value;\n yield* firstPage.data;\n let nextPageToken = firstPage.nextPageToken;\n while (nextPageToken && !signal?.aborted) {\n const nextPageResult = await getPage({ pageParam: nextPageToken, signal }).promise;\n if (nextPageResult.isErr()) {\n throw nextPageResult.error;\n }\n const nextPage = nextPageResult.value;\n yield* nextPage.data;\n nextPageToken = nextPage.nextPageToken;\n }\n },\n getPage,\n };\n }\n\n _catalogReferenceFromEntity(entity: unknown) {\n return catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n );\n }\n}\n"]}
|
|
@@ -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;IAC1B,SAAS,CAAgB;IACzB,EAAE,CAAS;IACX,
|
|
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;IAC1B,SAAS,CAAgB;IACzB,EAAE,CAAS;IACX,YAAY,CAAuD;IACnE,MAAM,CAAiD;IACvD,QAAQ,CAAS;IAE1B,YAAY,MAAgB,EAAE,UAAgD;QAC5E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IACtC,CAAC;IAED,IAAI,WAAW;QACb,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,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,EA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,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAkD,CAAC;aACxE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,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;YACp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AgB,CAAC,MAAc,EAAE,MAAc,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,MAAM,iBAAiB,MAAM,EAAE,EAAE;YACtE,MAAM,EAAE,QAAQ;YAChB,MAAM;SACP,CAAC,CAAC;IACL,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 { 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,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CAAC,CAAC,CAAC,CAAC;CACrD,CAAC,EACF;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,KAAK,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI;YACrB,UAAU,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;YAC9B,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;YAC9B,EAAE,EAAE,CAAC,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);
|