@dremio/js-sdk 0.31.0 → 0.31.2
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/Dremio.d.ts +7 -1
- package/dist/cloud/Dremio.js +1 -1
- package/dist/cloud/Dremio.js.map +1 -1
- package/dist/cloud/catalog/EnterpriseCatalogResource.d.ts +25 -0
- package/dist/cloud/catalog/EnterpriseCatalogResource.js +71 -0
- package/dist/cloud/catalog/EnterpriseCatalogResource.js.map +1 -0
- package/dist/cloud/getResourceConfig.d.ts +6 -0
- package/dist/cloud/getResourceConfig.js +29 -16
- package/dist/cloud/getResourceConfig.js.map +1 -1
- package/dist/cloud/index.d.ts +1 -0
- package/dist/cloud/index.js +1 -0
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/organizations/Organization.d.ts +3 -3
- package/dist/cloud/projects/projectPropertiesCodec.js +22 -1
- package/dist/cloud/projects/projectPropertiesCodec.js.map +1 -1
- package/dist/cloud/replaceOriginResource.d.ts +6 -0
- package/dist/cloud/replaceOriginResource.js +35 -0
- package/dist/cloud/replaceOriginResource.js.map +1 -0
- package/dist/common/Config.d.ts +6 -0
- package/dist/common/Config.js.map +1 -1
- package/dist/enterprise/Dremio.d.ts +12 -5
- package/dist/oss/Dremio.d.ts +12 -5
- package/dist/oss/getResourceConfig.d.ts +12 -5
- package/dist/oss/getResourceConfig.js +15 -5
- package/dist/oss/getResourceConfig.js.map +1 -1
- package/package.json +1 -1
package/dist/cloud/Dremio.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config } from "../common/Config.ts";
|
|
2
|
-
import { EnterpriseCatalogResource } from "
|
|
2
|
+
import { EnterpriseCatalogResource } from "./catalog/EnterpriseCatalogResource.js";
|
|
3
3
|
import { RolesResource } from "../enterprise/roles/RolesResource.js";
|
|
4
4
|
import { EnterpriseScriptsResource } from "../enterprise/scripts/EnterpriseScriptsResource.js";
|
|
5
5
|
import { SqlResource } from "../oss/sql/SqlResource.js";
|
|
@@ -42,10 +42,16 @@ export declare class Dremio {
|
|
|
42
42
|
origin: string;
|
|
43
43
|
request: import("../common/Config.ts").RequestFn;
|
|
44
44
|
sonarV2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
45
|
+
sonarV2URL: (path: string) => URL;
|
|
45
46
|
sonarV3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
47
|
+
sonarV3URL: (path: string) => URL;
|
|
46
48
|
sonarV4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
49
|
+
sonarV4URL: (path: string) => URL;
|
|
47
50
|
v2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
51
|
+
v2URL: (path: string) => URL;
|
|
48
52
|
v3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
53
|
+
v3URL: (path: string) => URL;
|
|
49
54
|
v4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
55
|
+
v4URL: (path: string) => URL;
|
|
50
56
|
};
|
|
51
57
|
}
|
package/dist/cloud/Dremio.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import moize from "moize";
|
|
17
|
-
import { EnterpriseCatalogResource } from "
|
|
17
|
+
import { EnterpriseCatalogResource } from "./catalog/EnterpriseCatalogResource.js";
|
|
18
18
|
import { RolesResource } from "../enterprise/roles/RolesResource.js";
|
|
19
19
|
import { EnterpriseScriptsResource } from "../enterprise/scripts/EnterpriseScriptsResource.js";
|
|
20
20
|
import { SqlResource } from "../oss/sql/SqlResource.js";
|
package/dist/cloud/Dremio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/cloud/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/cloud/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,MAAM,OAAO,MAAM;IACR,EAAE,CAAa;IACf,MAAM,CAAwC;IAC9C,OAAO,C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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 moize from \"moize\";\nimport type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"./catalog/EnterpriseCatalogResource.js\";\nimport { RolesResource } from \"../enterprise/roles/RolesResource.js\";\nimport { EnterpriseScriptsResource } from \"../enterprise/scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { AiResource } from \"./ai/AiResource.ts\";\nimport { ArcticResource } from \"./arctic/ArcticResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { getResourceConfig } from \"./getResourceConfig.ts\";\nimport { OrganizationsResource } from \"./organizations/OrganizationsResource.js\";\nimport { ProjectsResource } from \"./projects/ProjectsResource.js\";\nimport { CloudUsersResource } from \"./users/CloudUsersResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport { OAuthApplicationsResource } from \"./oauth/OAuthApplicationsResource.ts\";\nimport { CloudsResource } from \"./clouds/CloudsResource.js\";\nimport { UsersResource } from \"./users/UsersResource.js\";\nimport { EngineRulesResource } from \"./engineRules/EngineRulesResource.ts\";\n\nexport class Dremio {\n readonly ai: AiResource;\n readonly arctic: (projectId: string) => ArcticResource;\n readonly catalog: (projectId: string) => EnterpriseCatalogResource;\n readonly clouds: CloudsResource;\n readonly engines: (projectId: string) => EnginesResource;\n readonly engineRules: (projectId: string) => EngineRulesResource;\n readonly jobs: (projectId: string) => JobsResource;\n readonly oauthApplications: OAuthApplicationsResource;\n readonly organizations: OrganizationsResource;\n readonly projects: ProjectsResource;\n readonly roles: (projectId: string) => RolesResource;\n readonly scripts: (projectId: string) => EnterpriseScriptsResource;\n readonly sql: (projectId: string) => SqlResource;\n readonly _users: UsersResource;\n readonly users: (projectId: string) => CloudUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.ai = new AiResource(this.#resourceConfig());\n this.arctic = moize.default(\n (projectId: string) => new ArcticResource(this.#resourceConfig(projectId)),\n );\n this.catalog = moize.default(\n (projectId: string) => new EnterpriseCatalogResource(this.#resourceConfig(projectId)),\n );\n this.clouds = new CloudsResource(this.#resourceConfig());\n this.engines = moize.default(\n (projectId: string) => new EnginesResource(this.#resourceConfig(projectId)),\n );\n this.engineRules = moize.default(\n (projectId: string) => new EngineRulesResource(this.#resourceConfig(projectId)),\n );\n this.jobs = moize.default(\n (projectId: string) => new JobsResource(this.#resourceConfig(projectId)),\n );\n this.oauthApplications = new OAuthApplicationsResource(this.#resourceConfig());\n this.organizations = new OrganizationsResource(this.#resourceConfig());\n this.projects = new ProjectsResource(this.#resourceConfig());\n this.roles = moize.default(\n (projectId: string) => new RolesResource(this.#resourceConfig(projectId)),\n );\n this.scripts = moize.default(\n (projectId: string) => new EnterpriseScriptsResource(this.#resourceConfig(projectId)),\n );\n this.sql = moize.default(\n (projectId: string) => new SqlResource(this.#resourceConfig(projectId)),\n );\n this._users = new UsersResource(this.#resourceConfig());\n this.users = moize.default(\n (projectId: string) => new CloudUsersResource(this.#resourceConfig(projectId)),\n );\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SonarV3Config } from "../../common/Config.ts";
|
|
2
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
3
|
+
import { baseRetrieve, baseRetrieveByPath } from "../../enterprise/catalog/catalogRetrieve.js";
|
|
4
|
+
import type { CatalogSearchParams } from "../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts";
|
|
5
|
+
import type { EnterpriseFunctionCatalogReference, EnterpriseHomeCatalogReference, EnterpriseSourceCatalogReference, EnterpriseSpaceCatalogReference } from "../interfaces.ts";
|
|
6
|
+
export declare class EnterpriseCatalogResource {
|
|
7
|
+
#private;
|
|
8
|
+
retrieve: ReturnType<typeof baseRetrieve>;
|
|
9
|
+
retrieveByPath: ReturnType<typeof baseRetrieveByPath>;
|
|
10
|
+
constructor(config: SonarV3Config);
|
|
11
|
+
list(): {
|
|
12
|
+
data(): AsyncGenerator<EnterpriseFunctionCatalogReference | EnterpriseHomeCatalogReference | EnterpriseSourceCatalogReference | EnterpriseSpaceCatalogReference, void, unknown>;
|
|
13
|
+
};
|
|
14
|
+
search(params: CatalogSearchParams): {
|
|
15
|
+
data({ signal }?: SignalParam): AsyncGenerator<import("../interfaces.ts").FolderSearchResult | import("../interfaces.ts").ReflectionSearchResult | import("../interfaces.ts").SourceSearchResult | import("../interfaces.ts").SpaceSearchResult | import("../interfaces.ts").TableSearchResult | import("../interfaces.ts").ViewSearchResult | import("../interfaces.ts").FunctionSearchResult | import("../interfaces.ts").ScriptSearchResult | import("../interfaces.ts").JobSearchResult, void, unknown>;
|
|
16
|
+
getPage: ({ pageParam, signal }?: {
|
|
17
|
+
pageParam?: string;
|
|
18
|
+
} & SignalParam) => import("ts-results-es").AsyncResult<{
|
|
19
|
+
data: (import("../interfaces.ts").FolderSearchResult | import("../interfaces.ts").ReflectionSearchResult | import("../interfaces.ts").SourceSearchResult | import("../interfaces.ts").SpaceSearchResult | import("../interfaces.ts").TableSearchResult | import("../interfaces.ts").ViewSearchResult | import("../interfaces.ts").FunctionSearchResult | import("../interfaces.ts").ScriptSearchResult | import("../interfaces.ts").JobSearchResult)[];
|
|
20
|
+
nextPageToken: string | undefined;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
}, import("../index.ts").HttpError>;
|
|
23
|
+
};
|
|
24
|
+
_catalogReferenceFromEntity(entity: unknown): import("../interfaces.ts").EnterpriseCatalogReference;
|
|
25
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { catalogReferenceFromProperties } from "../../enterprise/catalog/catalogReferenceFromProperties.js";
|
|
17
|
+
import { baseRetrieve, baseRetrieveByPath } from "../../enterprise/catalog/catalogRetrieve.js";
|
|
18
|
+
import { createCatalogSearch } from "../../enterprise/catalog/catalogSearch/createCatalogSearch.js";
|
|
19
|
+
import { catalogReferenceEntityToProperties } from "../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.js";
|
|
20
|
+
export class EnterpriseCatalogResource {
|
|
21
|
+
#config;
|
|
22
|
+
#catalogSearch;
|
|
23
|
+
retrieve;
|
|
24
|
+
retrieveByPath;
|
|
25
|
+
constructor(config) {
|
|
26
|
+
this.#config = config;
|
|
27
|
+
this.retrieve = baseRetrieve(config);
|
|
28
|
+
this.retrieveByPath = baseRetrieveByPath(config);
|
|
29
|
+
this.#catalogSearch = createCatalogSearch(this.#config, this._catalogReferenceFromEntity.bind(this));
|
|
30
|
+
}
|
|
31
|
+
list() {
|
|
32
|
+
const getRoot = () => this.#config
|
|
33
|
+
.sonarV3Request("catalog")
|
|
34
|
+
.map((res) => res.json())
|
|
35
|
+
.map((response) => response.data.map((entity) => catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), this.#config, this.retrieveByPath)))
|
|
36
|
+
.promise.then((result) => result.unwrap());
|
|
37
|
+
return {
|
|
38
|
+
async *data() {
|
|
39
|
+
yield* await getRoot();
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
search(params) {
|
|
44
|
+
const getPage = ({ pageParam, signal } = {}) => this.#catalogSearch(params, { pageParam, signal });
|
|
45
|
+
return {
|
|
46
|
+
async *data({ signal } = {}) {
|
|
47
|
+
const firstPageResult = await getPage({ signal }).promise;
|
|
48
|
+
if (firstPageResult.isErr()) {
|
|
49
|
+
throw firstPageResult.error;
|
|
50
|
+
}
|
|
51
|
+
const firstPage = firstPageResult.value;
|
|
52
|
+
yield* firstPage.data;
|
|
53
|
+
let nextPageToken = firstPage.nextPageToken;
|
|
54
|
+
while (nextPageToken && !signal?.aborted) {
|
|
55
|
+
const nextPageResult = await getPage({ pageParam: nextPageToken, signal }).promise;
|
|
56
|
+
if (nextPageResult.isErr()) {
|
|
57
|
+
throw nextPageResult.error;
|
|
58
|
+
}
|
|
59
|
+
const nextPage = nextPageResult.value;
|
|
60
|
+
yield* nextPage.data;
|
|
61
|
+
nextPageToken = nextPage.nextPageToken;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
getPage,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
_catalogReferenceFromEntity(entity) {
|
|
68
|
+
return catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), this.#config, this.retrieveByPath);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=EnterpriseCatalogResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/cloud/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,C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, 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 type { SonarV3Config } 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\";\n\nexport class EnterpriseCatalogResource {\n #config: SonarV3Config;\n #catalogSearch: ReturnType<typeof createCatalogSearch>;\n\n retrieve: ReturnType<typeof baseRetrieve>;\n retrieveByPath: ReturnType<typeof baseRetrieveByPath>;\n\n constructor(config: SonarV3Config) {\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 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"]}
|
|
@@ -9,9 +9,15 @@ export declare const getResourceConfig: (config: Config) => (projectId?: string)
|
|
|
9
9
|
origin: string;
|
|
10
10
|
request: import("../common/Config.ts").RequestFn;
|
|
11
11
|
sonarV2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
12
|
+
sonarV2URL: (path: string) => URL;
|
|
12
13
|
sonarV3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
14
|
+
sonarV3URL: (path: string) => URL;
|
|
13
15
|
sonarV4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
16
|
+
sonarV4URL: (path: string) => URL;
|
|
14
17
|
v2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
18
|
+
v2URL: (path: string) => URL;
|
|
15
19
|
v3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
20
|
+
v3URL: (path: string) => URL;
|
|
16
21
|
v4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
22
|
+
v4URL: (path: string) => URL;
|
|
17
23
|
};
|
|
@@ -14,8 +14,25 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { createRequest } from "../common/createRequest.js";
|
|
17
|
+
import { _replaceOriginResource } from "./replaceOriginResource.js";
|
|
17
18
|
export const getResourceConfig = (config) => (projectId) => {
|
|
18
19
|
const request = createRequest(config);
|
|
20
|
+
const sonarV2URL = (path) => new URL(`/ui/projects/${projectId}/${path}`, _replaceOriginResource("api", "app"));
|
|
21
|
+
const sonarV3URL = (path) => {
|
|
22
|
+
if (!projectId) {
|
|
23
|
+
throw new Error("projectId is required");
|
|
24
|
+
}
|
|
25
|
+
return new URL(`/v0/projects/${projectId}/${path}`, config.origin);
|
|
26
|
+
};
|
|
27
|
+
const sonarV4URL = (path) => {
|
|
28
|
+
if (!projectId) {
|
|
29
|
+
throw new Error("projectId is required");
|
|
30
|
+
}
|
|
31
|
+
return new URL(`/v1/projects/${projectId}/${path}`, config.origin);
|
|
32
|
+
};
|
|
33
|
+
const v2URL = (path) => new URL(`/ui/${path}`, _replaceOriginResource("api", "app"));
|
|
34
|
+
const v3URL = (path) => new URL(`/v0/${path}`, config.origin);
|
|
35
|
+
const v4URL = (path) => new URL(`/v1/${path}`, config.origin);
|
|
19
36
|
return {
|
|
20
37
|
logger: config.logger,
|
|
21
38
|
origin: config.origin,
|
|
@@ -24,23 +41,19 @@ export const getResourceConfig = (config) => (projectId) => {
|
|
|
24
41
|
if (!projectId) {
|
|
25
42
|
throw new Error("projectId is required");
|
|
26
43
|
}
|
|
27
|
-
return request(
|
|
28
|
-
},
|
|
29
|
-
sonarV3Request: (path, init) => {
|
|
30
|
-
if (!projectId) {
|
|
31
|
-
throw new Error("projectId is required");
|
|
32
|
-
}
|
|
33
|
-
return request(`/v0/projects/${projectId}/${path}`, init);
|
|
34
|
-
},
|
|
35
|
-
sonarV4Request: (path, init) => {
|
|
36
|
-
if (!projectId) {
|
|
37
|
-
throw new Error("projectId is required");
|
|
38
|
-
}
|
|
39
|
-
return request(`/v1/projects/${projectId}/${path}`, init);
|
|
44
|
+
return request(sonarV2URL(path).toString(), init);
|
|
40
45
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
sonarV2URL,
|
|
47
|
+
sonarV3Request: (path, init) => request(sonarV3URL(path).toString(), init),
|
|
48
|
+
sonarV3URL,
|
|
49
|
+
sonarV4Request: (path, init) => request(sonarV4URL(path).toString(), init),
|
|
50
|
+
sonarV4URL,
|
|
51
|
+
v2Request: (path, init) => request(v2URL(path).toString(), init),
|
|
52
|
+
v2URL,
|
|
53
|
+
v3Request: (path, init) => request(v3URL(path).toString(), init),
|
|
54
|
+
v3URL,
|
|
55
|
+
v4Request: (path, init) => request(v4URL(path).toString(), init),
|
|
56
|
+
v4URL,
|
|
44
57
|
};
|
|
45
58
|
};
|
|
46
59
|
//# sourceMappingURL=getResourceConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;A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CAAC;IAEtE,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE;YACnD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,UAAU;QACV,cAAc,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CACnD,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QAC5C,UAAU;QACV,cAAc,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CACnD,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QAC5C,UAAU;QACV,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QACtF,KAAK;QACL,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QACtF,KAAK;QACL,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QACtF,KAAK;KAOG,CAAC;AACb,CAAC,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 type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V2Config,\n V3Config,\n V4Config,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\nimport { _replaceOriginResource } from \"./replaceOriginResource.ts\";\n\nexport const getResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n\n const sonarV2URL = (path: string) =>\n new URL(`/ui/projects/${projectId}/${path}`, _replaceOriginResource(\"api\", \"app\"));\n\n const sonarV3URL = (path: string) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return new URL(`/v0/projects/${projectId}/${path}`, config.origin);\n };\n\n const sonarV4URL = (path: string) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return new URL(`/v1/projects/${projectId}/${path}`, config.origin);\n };\n\n const v2URL = (path: string) => new URL(`/ui/${path}`, _replaceOriginResource(\"api\", \"app\"));\n\n const v3URL = (path: string) => new URL(`/v0/${path}`, config.origin);\n\n const v4URL = (path: string) => new URL(`/v1/${path}`, config.origin);\n\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(sonarV2URL(path).toString(), init);\n },\n sonarV2URL,\n sonarV3Request: (path: string, init?: RequestInit) =>\n request(sonarV3URL(path).toString(), init),\n sonarV3URL,\n sonarV4Request: (path: string, init?: RequestInit) =>\n request(sonarV4URL(path).toString(), init),\n sonarV4URL,\n v2Request: (path: string, init?: RequestInit) => request(v2URL(path).toString(), init),\n v2URL,\n v3Request: (path: string, init?: RequestInit) => request(v3URL(path).toString(), init),\n v3URL,\n v4Request: (path: string, init?: RequestInit) => request(v4URL(path).toString(), init),\n v4URL,\n } satisfies ResourceConfig &\n SonarV2Config &\n SonarV3Config &\n SonarV4Config &\n V2Config &\n V3Config &\n V4Config;\n};\n"]}
|
package/dist/cloud/index.d.ts
CHANGED
package/dist/cloud/index.js
CHANGED
package/dist/cloud/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,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\nexport * from \"./Dremio.ts\";\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport * from \"./oauth/oauth.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,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\nexport * from \"./Dremio.ts\";\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport * from \"./oauth/oauth.ts\";\nexport * from \"./replaceOriginResource.ts\";\n"]}
|
|
@@ -13,8 +13,8 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
13
13
|
secretAccessKey: z.ZodMiniString<string>;
|
|
14
14
|
type: z.ZodMiniEnum<{
|
|
15
15
|
ACCESS_KEY: "ACCESS_KEY";
|
|
16
|
-
AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
|
|
17
16
|
IAM_ROLE: "IAM_ROLE";
|
|
17
|
+
AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
|
|
18
18
|
}>;
|
|
19
19
|
}, z.core.$strip>>;
|
|
20
20
|
auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -69,8 +69,8 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
69
69
|
secretAccessKey: z.ZodMiniString<string>;
|
|
70
70
|
type: z.ZodMiniEnum<{
|
|
71
71
|
ACCESS_KEY: "ACCESS_KEY";
|
|
72
|
-
AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
|
|
73
72
|
IAM_ROLE: "IAM_ROLE";
|
|
73
|
+
AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
|
|
74
74
|
}>;
|
|
75
75
|
}, z.core.$strip>>;
|
|
76
76
|
auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -137,8 +137,8 @@ export declare class Organization implements OrganizationProperties {
|
|
|
137
137
|
secretAccessKey: z.ZodMiniString<string>;
|
|
138
138
|
type: z.ZodMiniEnum<{
|
|
139
139
|
ACCESS_KEY: "ACCESS_KEY";
|
|
140
|
-
AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
|
|
141
140
|
IAM_ROLE: "IAM_ROLE";
|
|
141
|
+
AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
|
|
142
142
|
}>;
|
|
143
143
|
}, z.core.$strip>>;
|
|
144
144
|
auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -83,6 +83,27 @@ export const projectPropertiesCodec = z.codec(sharedProjectPropertiesInSchema, z
|
|
|
83
83
|
},
|
|
84
84
|
});
|
|
85
85
|
export const projectUpdateSchema = z.partial(z.extend(z.pick(projectPropertiesCodec.def.in, { credentials: true }), {
|
|
86
|
-
name: z.string().check(z.minLength(6, "Project name must be at least 6 characters"), z.maxLength(30, "Project name must be at most 30 characters"), z.regex(/^[a-z][a-z0-9-]*[a-z0-9]$/, "Project name must start with a letter
|
|
86
|
+
name: z.string().check(z.minLength(6, "Project name must be at least 6 characters"), z.maxLength(30, "Project name must be at most 30 characters"), z.regex(/^[a-z][a-z0-9-]*[a-z0-9]$/, "Project name must start with a letter, contain only lowercase letters, numbers, and hyphens, and cannot end with a hyphen"), z.superRefine((val, ctx) => {
|
|
87
|
+
const foundWord = projectDisallowedWords.find((word) => val.includes(word));
|
|
88
|
+
if (foundWord) {
|
|
89
|
+
ctx.addIssue({
|
|
90
|
+
code: "custom",
|
|
91
|
+
input: val,
|
|
92
|
+
message: `Project name cannot contain the word "${foundWord}"`,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
})),
|
|
87
96
|
}));
|
|
97
|
+
const projectDisallowedWords = [
|
|
98
|
+
"dremio",
|
|
99
|
+
"ssl",
|
|
100
|
+
"admin",
|
|
101
|
+
"system",
|
|
102
|
+
"null",
|
|
103
|
+
"undefined",
|
|
104
|
+
"static",
|
|
105
|
+
"assets",
|
|
106
|
+
"login",
|
|
107
|
+
"logout",
|
|
108
|
+
];
|
|
88
109
|
//# sourceMappingURL=projectPropertiesCodec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/projects/projectPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACxC,CAAC,CAAC,MAAM,CAAC;YACP,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;YACvB,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACvC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;SAC9B,CAAC;QACF,CAAC,CAAC,MAAM,CAAC;YACP,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;YACtB,mBAAmB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC3C,kBAAkB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC1C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;YACnB,IAAI,EAAE,CAAC,CA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C,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,GAAG;gBACV,OAAO,EAAE,yCAAyC,SAAS,GAAG;aAC/D,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CACH;CACF,CAAC,CACH,CAAC;AAEF,MAAM,sBAAsB,GAAG;IAC7B,QAAQ;IACR,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;CACA,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\nconst sharedProjectPropertiesInSchema = z.object({\n cloudId: z.string(),\n cloudType: z.enum([\"AWS\", \"AZURE\"]),\n createdAt: z.string(),\n createdBy: z.string(),\n credentials: z.discriminatedUnion(\"type\", [\n z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.optional(z.string()),\n type: z.literal(\"ACCESS_KEY\"),\n }),\n z.object({\n externalId: z.string(),\n externalIdSignature: z.optional(z.string()),\n instanceProfileArn: z.optional(z.string()),\n roleArn: z.string(),\n type: z.literal(\"IAM_ROLE\"),\n }),\n z.object({\n accountName: z.string(),\n clientId: z.string(),\n clientSecret: z.string(),\n tenantId: z.string(),\n type: z.literal(\"AZURE_STORAGE_CLIENT_CREDENTIALS\"),\n }),\n ]),\n id: z.string(),\n jdbcConnectionString: z.optional(z.string()),\n lastStateError: z.optional(z.object({ error: z.string(), timestamp: z.number() })),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n numberOfEngines: z.number().check(z.int(), z.minimum(0)),\n primaryCatalog: z.optional(z.string()),\n projectStore: z.string(),\n state: z.enum([\n \"ACTIVATING\",\n \"ACTIVE\",\n \"ARCHIVED\",\n \"ARCHIVING\",\n \"CREATING\",\n \"DEACTIVATING\",\n \"INACTIVE\",\n \"RESTORING\",\n ]),\n type: z.enum([\"QUERY_ENGINE\"]),\n});\n\nexport const projectPropertiesCodec = z.codec(\n sharedProjectPropertiesInSchema,\n z.extend(z.omit(sharedProjectPropertiesInSchema, { createdAt: true, modifiedAt: true }), {\n createdAt: z.instanceof(Date),\n modifiedAt: z.instanceof(Date),\n }),\n {\n decode(v) {\n const { createdAt, modifiedAt, ...rest } = v;\n return {\n ...rest,\n createdAt: new Date(createdAt),\n modifiedAt: new Date(modifiedAt),\n };\n },\n encode(v) {\n const { createdAt, modifiedAt, ...rest } = v;\n return {\n ...rest,\n createdAt: createdAt.toString(),\n modifiedAt: modifiedAt.toString(),\n };\n },\n },\n);\n\nexport const projectUpdateSchema = z.partial(\n z.extend(z.pick(projectPropertiesCodec.def.in, { credentials: true }), {\n name: z.string().check(\n z.minLength(6, \"Project name must be at least 6 characters\"),\n z.maxLength(30, \"Project name must be at most 30 characters\"),\n z.regex(\n /^[a-z][a-z0-9-]*[a-z0-9]$/,\n \"Project name must start with a letter, contain only lowercase letters, numbers, and hyphens, and cannot end with a hyphen\",\n ),\n z.superRefine((val, ctx) => {\n const foundWord = projectDisallowedWords.find((word) => val.includes(word));\n if (foundWord) {\n ctx.addIssue({\n code: \"custom\",\n input: val,\n message: `Project name cannot contain the word \"${foundWord}\"`,\n });\n }\n }),\n ),\n }),\n);\n\nconst projectDisallowedWords = [\n \"dremio\",\n \"ssl\",\n \"admin\",\n \"system\",\n \"null\",\n \"undefined\",\n \"static\",\n \"assets\",\n \"login\",\n \"logout\",\n] as const;\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
const prodLikePattern = /^([^.]+)(\.(?:(?:eu\.)?dremio\.cloud|[^.]+\.dremio\.site))$/;
|
|
17
|
+
const daasEnginePattern = /^(dcs-aws-\d+-ns\.)([^.]+)(\.drem\.io)$/;
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export function _replaceOriginResource(origin, resource) {
|
|
23
|
+
const url = new URL(origin);
|
|
24
|
+
const hostname = url.hostname;
|
|
25
|
+
if (daasEnginePattern.test(hostname)) {
|
|
26
|
+
url.hostname = hostname.replace(daasEnginePattern, `$1${resource}$3`);
|
|
27
|
+
return url.origin;
|
|
28
|
+
}
|
|
29
|
+
if (prodLikePattern.test(hostname)) {
|
|
30
|
+
url.hostname = hostname.replace(prodLikePattern, `${resource}$2`);
|
|
31
|
+
return url.origin;
|
|
32
|
+
}
|
|
33
|
+
return url.origin;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=replaceOriginResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceOriginResource.js","sourceRoot":"","sources":["../../src/cloud/replaceOriginResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,eAAe,GAAG,6DAA6D,CAAC;AACtF,MAAM,iBAAiB,GAAG,yCAAyC,CAAC;AAEpE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwB,EAAE,QAAgB;IAC/E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAE9B,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC;QACtE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,QAAQ,IAAI,CAAC,CAAC;QAClE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,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 type { Config } from \"../common/Config.ts\";\n\nconst prodLikePattern = /^([^.]+)(\\.(?:(?:eu\\.)?dremio\\.cloud|[^.]+\\.dremio\\.site))$/;\nconst daasEnginePattern = /^(dcs-aws-\\d+-ns\\.)([^.]+)(\\.drem\\.io)$/;\n\n/**\n * @hidden\n * @internal\n */\nexport function _replaceOriginResource(origin: Config[\"origin\"], resource: string): string {\n const url = new URL(origin);\n const hostname = url.hostname;\n\n if (daasEnginePattern.test(hostname)) {\n url.hostname = hostname.replace(daasEnginePattern, `$1${resource}$3`);\n return url.origin;\n }\n\n if (prodLikePattern.test(hostname)) {\n url.hostname = hostname.replace(prodLikePattern, `${resource}$2`);\n return url.origin;\n }\n\n return url.origin;\n}\n"]}
|
package/dist/common/Config.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export type ResourceConfig = {
|
|
|
45
45
|
*/
|
|
46
46
|
export type SonarV2Config = {
|
|
47
47
|
sonarV2Request: RequestFn;
|
|
48
|
+
sonarV2URL: (path: string) => URL;
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
50
51
|
* @hidden
|
|
@@ -52,6 +53,7 @@ export type SonarV2Config = {
|
|
|
52
53
|
*/
|
|
53
54
|
export type SonarV3Config = {
|
|
54
55
|
sonarV3Request: RequestFn;
|
|
56
|
+
sonarV3URL: (path: string) => URL;
|
|
55
57
|
};
|
|
56
58
|
/**
|
|
57
59
|
* @hidden
|
|
@@ -59,6 +61,7 @@ export type SonarV3Config = {
|
|
|
59
61
|
*/
|
|
60
62
|
export type SonarV4Config = {
|
|
61
63
|
sonarV4Request: RequestFn;
|
|
64
|
+
sonarV4URL: (path: string) => URL;
|
|
62
65
|
};
|
|
63
66
|
/**
|
|
64
67
|
* @hidden
|
|
@@ -66,6 +69,7 @@ export type SonarV4Config = {
|
|
|
66
69
|
*/
|
|
67
70
|
export type V2Config = {
|
|
68
71
|
v2Request: RequestFn;
|
|
72
|
+
v2URL: (path: string) => URL;
|
|
69
73
|
};
|
|
70
74
|
/**
|
|
71
75
|
* @hidden
|
|
@@ -73,6 +77,7 @@ export type V2Config = {
|
|
|
73
77
|
*/
|
|
74
78
|
export type V3Config = {
|
|
75
79
|
v3Request: RequestFn;
|
|
80
|
+
v3URL: (path: string) => URL;
|
|
76
81
|
};
|
|
77
82
|
/**
|
|
78
83
|
* @hidden
|
|
@@ -80,4 +85,5 @@ export type V3Config = {
|
|
|
80
85
|
*/
|
|
81
86
|
export type V4Config = {
|
|
82
87
|
v4Request: RequestFn;
|
|
88
|
+
v4URL: (path: string) => URL;
|
|
83
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/common/Config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","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 type { AsyncResult } from \"ts-results-es\";\nimport type { CredentialProvider } from \"./CredentialProvider.ts\";\nimport type { HttpError } from \"./HttpError.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => AsyncResult<Response, HttpError>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: (input: string, init?: RequestInit) => Promise<Response>;\n\n /**\n * Dremio API base origin\n */\n origin: string;\n\n logger?: {\n debug: typeof console.debug;\n error: typeof console.error;\n info: typeof console.info;\n warn: typeof console.warn;\n };\n\n /**\n * Provides credentials to Dremio for all authenticated API requests.\n * Required unless using a custom `fetch` provider with its own credentials provision\n */\n credentials?: CredentialProvider;\n\n /**\n * Configure the maximum number of times to retry requests that failed due to a\n * temporary condition such as 429 or 503. Default is 10. Set to 0 to disable\n * automatic retry.\n */\n maxRetryCount?: number;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type ResourceConfig = {\n logger?: Config[\"logger\"];\n origin: Config[\"origin\"];\n request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV2Config = {\n sonarV2Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV3Config = {\n sonarV3Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV4Config = {\n sonarV4Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V2Config = {\n v2Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V3Config = {\n v3Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V4Config = {\n v4Request: RequestFn;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/common/Config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","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 type { AsyncResult } from \"ts-results-es\";\nimport type { CredentialProvider } from \"./CredentialProvider.ts\";\nimport type { HttpError } from \"./HttpError.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => AsyncResult<Response, HttpError>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: (input: string, init?: RequestInit) => Promise<Response>;\n\n /**\n * Dremio API base origin\n */\n origin: string;\n\n logger?: {\n debug: typeof console.debug;\n error: typeof console.error;\n info: typeof console.info;\n warn: typeof console.warn;\n };\n\n /**\n * Provides credentials to Dremio for all authenticated API requests.\n * Required unless using a custom `fetch` provider with its own credentials provision\n */\n credentials?: CredentialProvider;\n\n /**\n * Configure the maximum number of times to retry requests that failed due to a\n * temporary condition such as 429 or 503. Default is 10. Set to 0 to disable\n * automatic retry.\n */\n maxRetryCount?: number;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type ResourceConfig = {\n logger?: Config[\"logger\"];\n origin: Config[\"origin\"];\n request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV2Config = {\n sonarV2Request: RequestFn;\n sonarV2URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV3Config = {\n sonarV3Request: RequestFn;\n sonarV3URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV4Config = {\n sonarV4Request: RequestFn;\n sonarV4URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V2Config = {\n v2Request: RequestFn;\n v2URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V3Config = {\n v3Request: RequestFn;\n v3URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V4Config = {\n v4Request: RequestFn;\n v4URL: (path: string) => URL;\n};\n"]}
|
|
@@ -30,10 +30,17 @@ export declare class Dremio {
|
|
|
30
30
|
} | undefined;
|
|
31
31
|
origin: string;
|
|
32
32
|
request: import("../common/Config.ts").RequestFn;
|
|
33
|
-
sonarV2Request: (path: string, init
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
sonarV2Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
34
|
+
sonarV2URL: (path: string) => URL;
|
|
35
|
+
sonarV3Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
36
|
+
sonarV3URL: (path: string) => URL;
|
|
37
|
+
sonarV4Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
38
|
+
sonarV4URL: (path: string) => URL;
|
|
39
|
+
v2Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
40
|
+
v2URL: (path: string) => URL;
|
|
41
|
+
v3Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
42
|
+
v3URL: (path: string) => URL;
|
|
43
|
+
v4Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
44
|
+
v4URL: (path: string) => URL;
|
|
38
45
|
};
|
|
39
46
|
}
|
package/dist/oss/Dremio.d.ts
CHANGED
|
@@ -21,10 +21,17 @@ export declare class Dremio {
|
|
|
21
21
|
} | undefined;
|
|
22
22
|
origin: string;
|
|
23
23
|
request: import("../common/Config.ts").RequestFn;
|
|
24
|
-
sonarV2Request: (path: string, init
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
sonarV2Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
25
|
+
sonarV2URL: (path: string) => URL;
|
|
26
|
+
sonarV3Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
27
|
+
sonarV3URL: (path: string) => URL;
|
|
28
|
+
sonarV4Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
29
|
+
sonarV4URL: (path: string) => URL;
|
|
30
|
+
v2Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
31
|
+
v2URL: (path: string) => URL;
|
|
32
|
+
v3Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
33
|
+
v3URL: (path: string) => URL;
|
|
34
|
+
v4Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
35
|
+
v4URL: (path: string) => URL;
|
|
29
36
|
};
|
|
30
37
|
}
|
|
@@ -8,9 +8,16 @@ export declare const getResourceConfig: (config: Config) => {
|
|
|
8
8
|
} | undefined;
|
|
9
9
|
origin: string;
|
|
10
10
|
request: import("../common/Config.ts").RequestFn;
|
|
11
|
-
sonarV2Request: (path: string, init
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
sonarV2Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
12
|
+
sonarV2URL: (path: string) => URL;
|
|
13
|
+
sonarV3Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
14
|
+
sonarV3URL: (path: string) => URL;
|
|
15
|
+
sonarV4Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
16
|
+
sonarV4URL: (path: string) => URL;
|
|
17
|
+
v2Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
18
|
+
v2URL: (path: string) => URL;
|
|
19
|
+
v3Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
20
|
+
v3URL: (path: string) => URL;
|
|
21
|
+
v4Request: (path: string, init?: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
22
|
+
v4URL: (path: string) => URL;
|
|
16
23
|
};
|
|
@@ -16,15 +16,25 @@
|
|
|
16
16
|
import { createRequest } from "../common/createRequest.js";
|
|
17
17
|
export const getResourceConfig = (config) => {
|
|
18
18
|
const request = createRequest(config);
|
|
19
|
+
const sonarV2URL = (path) => new URL(`/apiv2/${path}`, config.origin);
|
|
20
|
+
const sonarV3URL = (path) => new URL(`/api/v3/${path}`, config.origin);
|
|
21
|
+
const sonarV4URL = (path) => new URL(`/api/v4/${path}`, config.origin);
|
|
19
22
|
return {
|
|
20
23
|
logger: config.logger,
|
|
21
24
|
origin: config.origin,
|
|
22
25
|
request,
|
|
23
|
-
sonarV2Request: (path, init) => request(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
sonarV2Request: (path, init) => request(sonarV2URL(path).toString(), init),
|
|
27
|
+
sonarV2URL,
|
|
28
|
+
sonarV3Request: (path, init) => request(sonarV3URL(path).toString(), init),
|
|
29
|
+
sonarV3URL,
|
|
30
|
+
sonarV4Request: (path, init) => request(sonarV4URL(path).toString(), init),
|
|
31
|
+
sonarV4URL,
|
|
32
|
+
v2Request: (path, init) => request(sonarV2URL(path).toString(), init),
|
|
33
|
+
v2URL: sonarV2URL,
|
|
34
|
+
v3Request: (path, init) => request(sonarV3URL(path).toString(), init),
|
|
35
|
+
v3URL: sonarV3URL,
|
|
36
|
+
v4Request: (path, init) => request(sonarV4URL(path).toString(), init),
|
|
37
|
+
v4URL: sonarV4URL,
|
|
28
38
|
};
|
|
29
39
|
};
|
|
30
40
|
//# sourceMappingURL=getResourceConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/oss/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/oss/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE;IAClD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,UAAU,IAAI,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAE9E,MAAM,UAAU,GA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UAAU;KAOT,CAAC;AACb,CAAC,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 type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V2Config,\n V3Config,\n V4Config,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\n\nexport const getResourceConfig = (config: Config) => {\n const request = createRequest(config);\n\n const sonarV2URL = (path: string) => new URL(`/apiv2/${path}`, config.origin);\n\n const sonarV3URL = (path: string) => new URL(`/api/v3/${path}`, config.origin);\n\n const sonarV4URL = (path: string) => new URL(`/api/v4/${path}`, config.origin);\n\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init?) => request(sonarV2URL(path).toString(), init),\n sonarV2URL,\n sonarV3Request: (path, init?) => request(sonarV3URL(path).toString(), init),\n sonarV3URL,\n sonarV4Request: (path, init?) => request(sonarV4URL(path).toString(), init),\n sonarV4URL,\n v2Request: (path, init?) => request(sonarV2URL(path).toString(), init),\n v2URL: sonarV2URL,\n v3Request: (path, init?) => request(sonarV3URL(path).toString(), init),\n v3URL: sonarV3URL,\n v4Request: (path, init?) => request(sonarV4URL(path).toString(), init),\n v4URL: sonarV4URL,\n } satisfies ResourceConfig &\n SonarV2Config &\n SonarV3Config &\n SonarV4Config &\n V2Config &\n V3Config &\n V4Config;\n};\n"]}
|