@dremio/js-sdk 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/cloud/projects/Project.d.ts +30 -24
  2. package/dist/cloud/projects/Project.js +25 -1
  3. package/dist/cloud/projects/Project.js.map +1 -1
  4. package/dist/cloud/projects/ProjectsResource.d.ts +3 -1
  5. package/dist/cloud/projects/ProjectsResource.js +10 -3
  6. package/dist/cloud/projects/ProjectsResource.js.map +1 -1
  7. package/dist/cloud/projects/projectPropertiesCodec.d.ts +122 -0
  8. package/dist/cloud/projects/projectPropertiesCodec.js +88 -0
  9. package/dist/cloud/projects/projectPropertiesCodec.js.map +1 -0
  10. package/dist/common/ConflictResolver.d.ts +1 -0
  11. package/dist/common/ConflictResolver.js +17 -0
  12. package/dist/common/ConflictResolver.js.map +1 -0
  13. package/dist/common/HttpError.js +3 -1
  14. package/dist/common/HttpError.js.map +1 -1
  15. package/dist/common/safeParseResultToResult.d.ts +3 -0
  16. package/dist/common/safeParseResultToResult.js +24 -0
  17. package/dist/common/safeParseResultToResult.js.map +1 -0
  18. package/dist/enterprise/roles/Role.d.ts +4 -4
  19. package/dist/enterprise/roles/Role.js +2 -2
  20. package/dist/enterprise/roles/Role.js.map +1 -1
  21. package/dist/enterprise/roles/RoleReference.d.ts +10 -0
  22. package/dist/enterprise/roles/RoleReference.js +22 -0
  23. package/dist/enterprise/roles/RoleReference.js.map +1 -0
  24. package/dist/enterprise/roles/RolesResource.d.ts +2 -2
  25. package/dist/enterprise/roles/RolesResource.js +3 -3
  26. package/dist/enterprise/roles/RolesResource.js.map +1 -1
  27. package/dist/enterprise/scripts/EnterpriseScript.d.ts +26 -20
  28. package/dist/enterprise/scripts/EnterpriseScript.js +47 -14
  29. package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
  30. package/dist/enterprise/scripts/EnterpriseScriptsResource.d.ts +4 -2
  31. package/dist/enterprise/scripts/EnterpriseScriptsResource.js +4 -2
  32. package/dist/enterprise/scripts/EnterpriseScriptsResource.js.map +1 -1
  33. package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.d.ts +32 -0
  34. package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.js +51 -0
  35. package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.js.map +1 -0
  36. package/dist/enterprise/users/EnterpriseUser.d.ts +40 -0
  37. package/dist/enterprise/users/EnterpriseUser.js +23 -0
  38. package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
  39. package/dist/enterprise/users/EnterpriseUsersResource.d.ts +6 -0
  40. package/dist/enterprise/users/EnterpriseUsersResource.js +28 -1
  41. package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
  42. package/dist/oss/jobs/JobsResource.d.ts +86 -2
  43. package/dist/oss/jobs/JobsResource.js +23 -0
  44. package/dist/oss/jobs/JobsResource.js.map +1 -1
  45. package/dist/oss/jobs/listJobs.d.ts +404 -0
  46. package/dist/oss/jobs/listJobs.js +202 -0
  47. package/dist/oss/jobs/listJobs.js.map +1 -0
  48. package/dist/oss/scripts/Script.d.ts +33 -41
  49. package/dist/oss/scripts/Script.js +35 -42
  50. package/dist/oss/scripts/Script.js.map +1 -1
  51. package/dist/oss/scripts/ScriptLike.d.ts +16 -0
  52. package/dist/oss/scripts/ScriptLike.js +17 -0
  53. package/dist/oss/scripts/ScriptLike.js.map +1 -0
  54. package/dist/oss/scripts/ScriptsResource.d.ts +4 -2
  55. package/dist/oss/scripts/ScriptsResource.js +4 -2
  56. package/dist/oss/scripts/ScriptsResource.js.map +1 -1
  57. package/dist/oss/scripts/scriptPropertiesCodec.d.ts +29 -0
  58. package/dist/oss/scripts/scriptPropertiesCodec.js +78 -0
  59. package/dist/oss/scripts/scriptPropertiesCodec.js.map +1 -0
  60. package/package.json +13 -13
  61. package/dist/cloud/projects/utils.d.ts +0 -2
  62. package/dist/cloud/projects/utils.js +0 -37
  63. package/dist/cloud/projects/utils.js.map +0 -1
@@ -1,5 +1,9 @@
1
- import type { Result } from "ts-results-es";
1
+ import { AsyncResult, type Result } from "ts-results-es";
2
2
  import type { ProjectsResource } from "./ProjectsResource.ts";
3
+ import { projectUpdateSchema, type projectPropertiesCodec } from "./projectPropertiesCodec.ts";
4
+ import * as z from "zod/mini";
5
+ import type { V3Config } from "../../common/Config.ts";
6
+ import type { HttpError } from "../../common/HttpError.ts";
3
7
  export declare class Project implements ProjectInterface {
4
8
  #private;
5
9
  readonly cloudId: ProjectInterface["cloudId"];
@@ -17,31 +21,33 @@ export declare class Project implements ProjectInterface {
17
21
  readonly projectStore: ProjectInterface["projectStore"];
18
22
  readonly state: ProjectInterface["state"];
19
23
  readonly type: ProjectInterface["type"];
20
- constructor(properties: ProjectProperties, projectsResource: ProjectsResource);
21
- activate(): Promise<Result<undefined, import("../index.ts").HttpError>>;
22
- delete(): Promise<Result<undefined, import("../index.ts").HttpError>>;
24
+ constructor(config: V3Config, properties: ProjectProperties, projectsResource: ProjectsResource);
25
+ activate(): Promise<Result<undefined, HttpError>>;
26
+ delete(): Promise<Result<undefined, HttpError>>;
27
+ update(properties: z.output<typeof projectUpdateSchema>): AsyncResult<Project, HttpError | z.core.util.SafeParseResult<z.output<typeof projectUpdateSchema>>["error"]>;
23
28
  get settled(): boolean;
29
+ static updateSchema: z.ZodMiniObject<{
30
+ credentials: z.ZodMiniOptional<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
31
+ accessKeyId: z.ZodMiniString<string>;
32
+ secretAccessKey: z.ZodMiniOptional<z.ZodMiniString<string>>;
33
+ type: z.ZodMiniLiteral<"ACCESS_KEY">;
34
+ }, z.core.$strip>, z.ZodMiniObject<{
35
+ externalId: z.ZodMiniString<string>;
36
+ externalIdSignature: z.ZodMiniOptional<z.ZodMiniString<string>>;
37
+ instanceProfileArn: z.ZodMiniOptional<z.ZodMiniString<string>>;
38
+ roleArn: z.ZodMiniString<string>;
39
+ type: z.ZodMiniLiteral<"IAM_ROLE">;
40
+ }, z.core.$strip>, z.ZodMiniObject<{
41
+ accountName: z.ZodMiniString<string>;
42
+ clientId: z.ZodMiniString<string>;
43
+ clientSecret: z.ZodMiniString<string>;
44
+ tenantId: z.ZodMiniString<string>;
45
+ type: z.ZodMiniLiteral<"AZURE_STORAGE_CLIENT_CREDENTIALS">;
46
+ }, z.core.$strip>], "type">>;
47
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
48
+ }, z.core.$strip>;
24
49
  }
25
- export type ProjectProperties = {
26
- readonly cloudId: string;
27
- readonly cloudType: "AWS" | "AZURE" | "UNKNOWN";
28
- readonly createdAt: Date;
29
- readonly createdBy: string;
30
- readonly credentials: Record<string, any>;
31
- readonly id: string;
32
- readonly lastStateError: {
33
- error: string;
34
- timestamp: Date;
35
- } | null;
36
- readonly modifiedAt: Date;
37
- readonly modifiedBy: string;
38
- readonly name: string;
39
- readonly numberOfEngines: number;
40
- readonly primaryCatalog: string;
41
- readonly projectStore: string;
42
- readonly state: "ACTIVATING" | "ACTIVE" | "ARCHIVED" | "ARCHIVING" | "CREATING" | "DEACTIVATING" | "INACTIVE" | "RESTORING";
43
- readonly type: "QUERY_ENGINE";
44
- };
50
+ export type ProjectProperties = z.output<typeof projectPropertiesCodec>;
45
51
  export type ProjectMethods = {
46
52
  delete(): Promise<Result<undefined, unknown>>;
47
53
  get settled(): boolean;
@@ -13,7 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { AsyncResult, Err } from "ts-results-es";
17
+ import { projectUpdateSchema } from "./projectPropertiesCodec.js";
18
+ import * as z from "zod/mini";
16
19
  export class Project {
20
+ #config;
17
21
  cloudId;
18
22
  cloudType;
19
23
  createdAt;
@@ -30,7 +34,8 @@ export class Project {
30
34
  state;
31
35
  type;
32
36
  #projectsResource;
33
- constructor(properties, projectsResource) {
37
+ constructor(config, properties, projectsResource) {
38
+ this.#config = config;
34
39
  this.cloudId = properties.cloudId;
35
40
  this.cloudType = properties.cloudType;
36
41
  this.createdAt = properties.createdAt;
@@ -54,8 +59,27 @@ export class Project {
54
59
  delete() {
55
60
  return this.#projectsResource.delete(this.id);
56
61
  }
62
+ update(properties) {
63
+ const parsedProperties = z.safeEncode(projectUpdateSchema, properties);
64
+ if (!parsedProperties.success) {
65
+ return new AsyncResult(Promise.resolve(Err(parsedProperties.error)));
66
+ }
67
+ return this.#config
68
+ .v3Request(`projects/${this.id}`, {
69
+ body: JSON.stringify(parsedProperties.data),
70
+ headers: {
71
+ Accept: "application/json",
72
+ "Content-Type": "application/json",
73
+ },
74
+ keepalive: true,
75
+ method: "PUT",
76
+ })
77
+ .map((res) => res.json())
78
+ .map((entity) => this.#projectsResource._createFromEntity(entity));
79
+ }
57
80
  get settled() {
58
81
  return this.state === "ACTIVE" || this.state === "ARCHIVED" || this.state === "INACTIVE";
59
82
  }
83
+ static updateSchema = projectUpdateSchema;
60
84
  }
61
85
  //# sourceMappingURL=Project.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,OAAO;IACT,OAAO,CAA8B;IACrC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,WAAW,CAAkC;IAC7C,EAAE,CAAyB;IAC3B,cAAc,CAAqC;IACnD,UAAU,CAAiC;IAC3C,UAAU,CAAiC;IAC3C,IAAI,CAA2B;IAC/B,eAAe,CAAsC;IACrD,cAAc,CAAqC;IACnD,YAAY,CAAmC;IAC/C,KAAK,CAA4B;IACjC,IAAI,CAA2B;IAExC,iBAAiB,CAAmB;IAEpC,YAAY,UAA6B,EAAE,gBAAkC;QAC3E,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;IAC3F,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 type { Result } from \"ts-results-es\";\nimport type { ProjectsResource } from \"./ProjectsResource.ts\";\n\nexport class Project implements ProjectInterface {\n readonly cloudId: ProjectInterface[\"cloudId\"];\n readonly cloudType: ProjectInterface[\"cloudType\"];\n readonly createdAt: ProjectInterface[\"createdAt\"];\n readonly createdBy: ProjectInterface[\"createdBy\"];\n readonly credentials: ProjectInterface[\"credentials\"];\n readonly id: ProjectInterface[\"id\"];\n readonly lastStateError: ProjectInterface[\"lastStateError\"];\n readonly modifiedAt: ProjectInterface[\"modifiedAt\"];\n readonly modifiedBy: ProjectInterface[\"modifiedBy\"];\n readonly name: ProjectInterface[\"name\"];\n readonly numberOfEngines: ProjectInterface[\"numberOfEngines\"];\n readonly primaryCatalog: ProjectInterface[\"primaryCatalog\"];\n readonly projectStore: ProjectInterface[\"projectStore\"];\n readonly state: ProjectInterface[\"state\"];\n readonly type: ProjectInterface[\"type\"];\n\n #projectsResource: ProjectsResource;\n\n constructor(properties: ProjectProperties, projectsResource: ProjectsResource) {\n this.cloudId = properties.cloudId;\n this.cloudType = properties.cloudType;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.credentials = properties.credentials;\n this.id = properties.id;\n this.lastStateError = properties.lastStateError;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.numberOfEngines = properties.numberOfEngines;\n this.primaryCatalog = properties.primaryCatalog;\n this.projectStore = properties.projectStore;\n this.state = properties.state;\n this.type = properties.type;\n this.#projectsResource = projectsResource;\n }\n\n activate() {\n return this.#projectsResource.activate(this.id);\n }\n\n delete() {\n return this.#projectsResource.delete(this.id);\n }\n\n get settled() {\n return this.state === \"ACTIVE\" || this.state === \"ARCHIVED\" || this.state === \"INACTIVE\";\n }\n}\n\nexport type ProjectProperties = {\n readonly cloudId: string;\n readonly cloudType: \"AWS\" | \"AZURE\" | \"UNKNOWN\";\n readonly createdAt: Date;\n readonly createdBy: string;\n readonly credentials: Record<string, any>;\n readonly id: string;\n readonly lastStateError: {\n error: string;\n timestamp: Date;\n } | null;\n readonly modifiedAt: Date;\n readonly modifiedBy: string;\n readonly name: string;\n readonly numberOfEngines: number;\n readonly primaryCatalog: string;\n readonly projectStore: string;\n readonly state:\n | \"ACTIVATING\"\n | \"ACTIVE\"\n | \"ARCHIVED\"\n | \"ARCHIVING\"\n | \"CREATING\"\n | \"DEACTIVATING\"\n | \"INACTIVE\"\n | \"RESTORING\";\n readonly type: \"QUERY_ENGINE\";\n};\n\nexport type ProjectMethods = {\n delete(): Promise<Result<undefined, unknown>>;\n get settled(): boolean;\n};\n\nexport type ProjectInterface = ProjectProperties & ProjectMethods;\n"]}
1
+ {"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,GAAG,EAAe,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAA+B,MAAM,6BAA6B,CAAC;AAC/F,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,MAAM,OAAO,OAAO;IACT,OAAO,CAAW;IAClB,OAAO,CAA8B;IACrC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,WAAW,CAAkC;IAC7C,EAAE,CAAyB;IAC3B,cAAc,CAAqC;IACnD,UAAU,CAAiC;IAC3C,UAAU,CAAiC;IAC3C,IAAI,CAA2B;IAC/B,eAAe,CAAsC;IACrD,cAAc,CAAqC;IACnD,YAAY,CAAmC;IAC/C,KAAK,CAA4B;IACjC,IAAI,CAA2B;IAExC,iBAAiB,CAAmB;IAEpC,YAAY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AU,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QACvE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC9B,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,IAAI,CAAC,EAAE,EAAE,EAAE;YAChC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAC3C,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAqD,CAAC;aAC3E,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;IAC3F,CAAC;IAED,MAAM,CAAC,YAAY,GAAG,mBAAmB,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 { AsyncResult, Err, type Result } from \"ts-results-es\";\nimport type { ProjectsResource } from \"./ProjectsResource.ts\";\nimport { projectUpdateSchema, type projectPropertiesCodec } from \"./projectPropertiesCodec.ts\";\nimport * as z from \"zod/mini\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class Project implements ProjectInterface {\n readonly #config: V3Config;\n readonly cloudId: ProjectInterface[\"cloudId\"];\n readonly cloudType: ProjectInterface[\"cloudType\"];\n readonly createdAt: ProjectInterface[\"createdAt\"];\n readonly createdBy: ProjectInterface[\"createdBy\"];\n readonly credentials: ProjectInterface[\"credentials\"];\n readonly id: ProjectInterface[\"id\"];\n readonly lastStateError: ProjectInterface[\"lastStateError\"];\n readonly modifiedAt: ProjectInterface[\"modifiedAt\"];\n readonly modifiedBy: ProjectInterface[\"modifiedBy\"];\n readonly name: ProjectInterface[\"name\"];\n readonly numberOfEngines: ProjectInterface[\"numberOfEngines\"];\n readonly primaryCatalog: ProjectInterface[\"primaryCatalog\"];\n readonly projectStore: ProjectInterface[\"projectStore\"];\n readonly state: ProjectInterface[\"state\"];\n readonly type: ProjectInterface[\"type\"];\n\n #projectsResource: ProjectsResource;\n\n constructor(config: V3Config, properties: ProjectProperties, projectsResource: ProjectsResource) {\n this.#config = config;\n this.cloudId = properties.cloudId;\n this.cloudType = properties.cloudType;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.credentials = properties.credentials;\n this.id = properties.id;\n this.lastStateError = properties.lastStateError;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.numberOfEngines = properties.numberOfEngines;\n this.primaryCatalog = properties.primaryCatalog;\n this.projectStore = properties.projectStore;\n this.state = properties.state;\n this.type = properties.type;\n this.#projectsResource = projectsResource;\n }\n\n activate() {\n return this.#projectsResource.activate(this.id);\n }\n\n delete() {\n return this.#projectsResource.delete(this.id);\n }\n\n update(\n properties: z.output<typeof projectUpdateSchema>,\n ): AsyncResult<\n Project,\n HttpError | z.core.util.SafeParseResult<z.output<typeof projectUpdateSchema>>[\"error\"]\n > {\n const parsedProperties = z.safeEncode(projectUpdateSchema, properties);\n if (!parsedProperties.success) {\n return new AsyncResult(Promise.resolve(Err(parsedProperties.error)));\n }\n return this.#config\n .v3Request(`projects/${this.id}`, {\n body: JSON.stringify(parsedProperties.data),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof projectPropertiesCodec>>)\n .map((entity) => this.#projectsResource._createFromEntity(entity));\n }\n\n get settled() {\n return this.state === \"ACTIVE\" || this.state === \"ARCHIVED\" || this.state === \"INACTIVE\";\n }\n\n static updateSchema = projectUpdateSchema;\n}\n\nexport type ProjectProperties = z.output<typeof projectPropertiesCodec>;\n\nexport type ProjectMethods = {\n delete(): Promise<Result<undefined, unknown>>;\n get settled(): boolean;\n};\n\nexport type ProjectInterface = ProjectProperties & ProjectMethods;\n"]}
@@ -1,10 +1,12 @@
1
1
  import type { ResourceConfig, V3Config } from "../../common/Config.ts";
2
2
  import { Project } from "./Project.ts";
3
3
  import type { SignalParam } from "../../common/Params.ts";
4
+ import * as z from "zod/mini";
5
+ import { projectPropertiesCodec } from "./projectPropertiesCodec.js";
4
6
  export declare class ProjectsResource {
5
7
  #private;
6
8
  constructor(config: ResourceConfig & V3Config);
7
- _createFromEntity(properties: unknown): Project;
9
+ _createFromEntity(entity: z.input<typeof projectPropertiesCodec>): Project;
8
10
  activate(id: string): Promise<import("ts-results-es").Result<undefined, import("../index.ts").HttpError>>;
9
11
  delete(id: string): Promise<import("ts-results-es").Result<undefined, import("../index.ts").HttpError>>;
10
12
  list(): {
@@ -14,16 +14,23 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Project } from "./Project.js";
17
- import { projectEntityToProperties } from "./utils.js";
18
17
  import { fromAbortable } from "../../common/fromAbortable.js";
19
18
  import { share, switchMap, timer } from "rxjs";
19
+ import * as z from "zod/mini";
20
+ import { projectPropertiesCodec } from "./projectPropertiesCodec.js";
20
21
  export class ProjectsResource {
21
22
  #config;
22
23
  constructor(config) {
23
24
  this.#config = config;
24
25
  }
25
- _createFromEntity(properties) {
26
- return new Project(projectEntityToProperties(properties), this);
26
+ _createFromEntity(entity) {
27
+ try {
28
+ return new Project(this.#config, z.decode(projectPropertiesCodec, entity), this);
29
+ }
30
+ catch (e) {
31
+ this.#config.logger?.error(entity, "failed to parse");
32
+ throw e;
33
+ }
27
34
  }
28
35
  activate(id) {
29
36
  return this.#config
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectsResource.js","sourceRoot":"","sources":["../../../src/cloud/projects/ProjectsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE/C,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,UAAmB;QACnC,OAAO,IAAI,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,EAAE,WAAW,EAAE;YACpC,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,O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AAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACvC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,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 type { ResourceConfig, V3Config } from \"../../common/Config.ts\";\nimport { Project } from \"./Project.ts\";\nimport { projectEntityToProperties } from \"./utils.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport { share, switchMap, timer } from \"rxjs\";\n\nexport class ProjectsResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n _createFromEntity(properties: unknown) {\n return new Project(projectEntityToProperties(properties), this);\n }\n\n activate(id: string) {\n return this.#config\n .v3Request(`projects/${id}/activate`, {\n keepalive: true,\n method: \"PUT\",\n })\n .map(() => undefined).promise;\n }\n\n delete(id: string) {\n return this.#config\n .v3Request(`projects/${id}`, { keepalive: true, method: \"DELETE\" })\n .map(() => undefined).promise;\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"projects\", { signal })\n .map((res) => res.json() as Promise<unknown[]>)\n .map((projects) => projects.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n observe(id: string) {\n return timer(0, 5000).pipe(\n switchMap(() =>\n fromAbortable(({ signal }) =>\n this.retrieve(id, { signal }).then((result) => result.unwrap()),\n ),\n ),\n share(),\n );\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`projects/${id}`, { signal })\n .map((res) => res.json())\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}
1
+ {"version":3,"file":"ProjectsResource.js","sourceRoot":"","sources":["../../../src/cloud/projects/ProjectsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,MAA8C;QAC9D,IAAI,CAAC;YACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;QACnF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;YACtD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,O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EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAChE,CACF,EACD,KAAK,EAAE,CACR,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACvC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAqD,CAAC;aAC3E,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,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 type { ResourceConfig, V3Config } from \"../../common/Config.ts\";\nimport { Project } from \"./Project.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport { share, switchMap, timer } from \"rxjs\";\nimport * as z from \"zod/mini\";\nimport { projectPropertiesCodec } from \"./projectPropertiesCodec.js\";\nexport class ProjectsResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n _createFromEntity(entity: z.input<typeof projectPropertiesCodec>) {\n try {\n return new Project(this.#config, z.decode(projectPropertiesCodec, entity), this);\n } catch (e) {\n this.#config.logger?.error(entity, \"failed to parse\");\n throw e;\n }\n }\n\n activate(id: string) {\n return this.#config\n .v3Request(`projects/${id}/activate`, {\n keepalive: true,\n method: \"PUT\",\n })\n .map(() => undefined).promise;\n }\n\n delete(id: string) {\n return this.#config\n .v3Request(`projects/${id}`, { keepalive: true, method: \"DELETE\" })\n .map(() => undefined).promise;\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"projects\", { signal })\n .map((res) => res.json() as Promise<z.input<typeof projectPropertiesCodec>[]>)\n .map((projects) => projects.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n observe(id: string) {\n return timer(0, 5000).pipe(\n switchMap(() =>\n fromAbortable(({ signal }) =>\n this.retrieve(id, { signal }).then((result) => result.unwrap()),\n ),\n ),\n share(),\n );\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`projects/${id}`, { signal })\n .map((res) => res.json() as Promise<z.input<typeof projectPropertiesCodec>>)\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}
@@ -0,0 +1,122 @@
1
+ import * as z from "zod/mini";
2
+ export declare const projectPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
3
+ cloudId: z.ZodMiniString<string>;
4
+ cloudType: z.ZodMiniEnum<{
5
+ AWS: "AWS";
6
+ AZURE: "AZURE";
7
+ }>;
8
+ createdAt: z.ZodMiniString<string>;
9
+ createdBy: z.ZodMiniString<string>;
10
+ credentials: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
11
+ accessKeyId: z.ZodMiniString<string>;
12
+ secretAccessKey: z.ZodMiniOptional<z.ZodMiniString<string>>;
13
+ type: z.ZodMiniLiteral<"ACCESS_KEY">;
14
+ }, z.core.$strip>, z.ZodMiniObject<{
15
+ externalId: z.ZodMiniString<string>;
16
+ externalIdSignature: z.ZodMiniOptional<z.ZodMiniString<string>>;
17
+ instanceProfileArn: z.ZodMiniOptional<z.ZodMiniString<string>>;
18
+ roleArn: z.ZodMiniString<string>;
19
+ type: z.ZodMiniLiteral<"IAM_ROLE">;
20
+ }, z.core.$strip>, z.ZodMiniObject<{
21
+ accountName: z.ZodMiniString<string>;
22
+ clientId: z.ZodMiniString<string>;
23
+ clientSecret: z.ZodMiniString<string>;
24
+ tenantId: z.ZodMiniString<string>;
25
+ type: z.ZodMiniLiteral<"AZURE_STORAGE_CLIENT_CREDENTIALS">;
26
+ }, z.core.$strip>], "type">;
27
+ id: z.ZodMiniString<string>;
28
+ jdbcConnectionString: z.ZodMiniOptional<z.ZodMiniString<string>>;
29
+ lastStateError: z.ZodMiniOptional<z.ZodMiniObject<{
30
+ error: z.ZodMiniString<string>;
31
+ timestamp: z.ZodMiniNumber<number>;
32
+ }, z.core.$strip>>;
33
+ modifiedAt: z.ZodMiniString<string>;
34
+ modifiedBy: z.ZodMiniString<string>;
35
+ name: z.ZodMiniString<string>;
36
+ numberOfEngines: z.ZodMiniNumber<number>;
37
+ primaryCatalog: z.ZodMiniOptional<z.ZodMiniString<string>>;
38
+ projectStore: z.ZodMiniString<string>;
39
+ state: z.ZodMiniEnum<{
40
+ ACTIVE: "ACTIVE";
41
+ INACTIVE: "INACTIVE";
42
+ ACTIVATING: "ACTIVATING";
43
+ ARCHIVED: "ARCHIVED";
44
+ ARCHIVING: "ARCHIVING";
45
+ CREATING: "CREATING";
46
+ DEACTIVATING: "DEACTIVATING";
47
+ RESTORING: "RESTORING";
48
+ }>;
49
+ type: z.ZodMiniEnum<{
50
+ QUERY_ENGINE: "QUERY_ENGINE";
51
+ }>;
52
+ }, z.core.$strip>, z.ZodMiniObject<{
53
+ type: z.ZodMiniEnum<{
54
+ QUERY_ENGINE: "QUERY_ENGINE";
55
+ }>;
56
+ name: z.ZodMiniString<string>;
57
+ id: z.ZodMiniString<string>;
58
+ state: z.ZodMiniEnum<{
59
+ ACTIVE: "ACTIVE";
60
+ INACTIVE: "INACTIVE";
61
+ ACTIVATING: "ACTIVATING";
62
+ ARCHIVED: "ARCHIVED";
63
+ ARCHIVING: "ARCHIVING";
64
+ CREATING: "CREATING";
65
+ DEACTIVATING: "DEACTIVATING";
66
+ RESTORING: "RESTORING";
67
+ }>;
68
+ createdBy: z.ZodMiniString<string>;
69
+ modifiedBy: z.ZodMiniString<string>;
70
+ cloudId: z.ZodMiniString<string>;
71
+ cloudType: z.ZodMiniEnum<{
72
+ AWS: "AWS";
73
+ AZURE: "AZURE";
74
+ }>;
75
+ credentials: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
76
+ accessKeyId: z.ZodMiniString<string>;
77
+ secretAccessKey: z.ZodMiniOptional<z.ZodMiniString<string>>;
78
+ type: z.ZodMiniLiteral<"ACCESS_KEY">;
79
+ }, z.core.$strip>, z.ZodMiniObject<{
80
+ externalId: z.ZodMiniString<string>;
81
+ externalIdSignature: z.ZodMiniOptional<z.ZodMiniString<string>>;
82
+ instanceProfileArn: z.ZodMiniOptional<z.ZodMiniString<string>>;
83
+ roleArn: z.ZodMiniString<string>;
84
+ type: z.ZodMiniLiteral<"IAM_ROLE">;
85
+ }, z.core.$strip>, z.ZodMiniObject<{
86
+ accountName: z.ZodMiniString<string>;
87
+ clientId: z.ZodMiniString<string>;
88
+ clientSecret: z.ZodMiniString<string>;
89
+ tenantId: z.ZodMiniString<string>;
90
+ type: z.ZodMiniLiteral<"AZURE_STORAGE_CLIENT_CREDENTIALS">;
91
+ }, z.core.$strip>], "type">;
92
+ jdbcConnectionString: z.ZodMiniOptional<z.ZodMiniString<string>>;
93
+ lastStateError: z.ZodMiniOptional<z.ZodMiniObject<{
94
+ error: z.ZodMiniString<string>;
95
+ timestamp: z.ZodMiniNumber<number>;
96
+ }, z.core.$strip>>;
97
+ numberOfEngines: z.ZodMiniNumber<number>;
98
+ primaryCatalog: z.ZodMiniOptional<z.ZodMiniString<string>>;
99
+ projectStore: z.ZodMiniString<string>;
100
+ createdAt: z.ZodMiniCustom<Date, Date>;
101
+ modifiedAt: z.ZodMiniCustom<Date, Date>;
102
+ }, z.core.$strip>>;
103
+ export declare const projectUpdateSchema: z.ZodMiniObject<{
104
+ credentials: z.ZodMiniOptional<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
105
+ accessKeyId: z.ZodMiniString<string>;
106
+ secretAccessKey: z.ZodMiniOptional<z.ZodMiniString<string>>;
107
+ type: z.ZodMiniLiteral<"ACCESS_KEY">;
108
+ }, z.core.$strip>, z.ZodMiniObject<{
109
+ externalId: z.ZodMiniString<string>;
110
+ externalIdSignature: z.ZodMiniOptional<z.ZodMiniString<string>>;
111
+ instanceProfileArn: z.ZodMiniOptional<z.ZodMiniString<string>>;
112
+ roleArn: z.ZodMiniString<string>;
113
+ type: z.ZodMiniLiteral<"IAM_ROLE">;
114
+ }, z.core.$strip>, z.ZodMiniObject<{
115
+ accountName: z.ZodMiniString<string>;
116
+ clientId: z.ZodMiniString<string>;
117
+ clientSecret: z.ZodMiniString<string>;
118
+ tenantId: z.ZodMiniString<string>;
119
+ type: z.ZodMiniLiteral<"AZURE_STORAGE_CLIENT_CREDENTIALS">;
120
+ }, z.core.$strip>], "type">>;
121
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
122
+ }, z.core.$strip>;
@@ -0,0 +1,88 @@
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 * as z from "zod/mini";
17
+ const sharedProjectPropertiesInSchema = z.object({
18
+ cloudId: z.string(),
19
+ cloudType: z.enum(["AWS", "AZURE"]),
20
+ createdAt: z.string(),
21
+ createdBy: z.string(),
22
+ credentials: z.discriminatedUnion("type", [
23
+ z.object({
24
+ accessKeyId: z.string(),
25
+ secretAccessKey: z.optional(z.string()),
26
+ type: z.literal("ACCESS_KEY"),
27
+ }),
28
+ z.object({
29
+ externalId: z.string(),
30
+ externalIdSignature: z.optional(z.string()),
31
+ instanceProfileArn: z.optional(z.string()),
32
+ roleArn: z.string(),
33
+ type: z.literal("IAM_ROLE"),
34
+ }),
35
+ z.object({
36
+ accountName: z.string(),
37
+ clientId: z.string(),
38
+ clientSecret: z.string(),
39
+ tenantId: z.string(),
40
+ type: z.literal("AZURE_STORAGE_CLIENT_CREDENTIALS"),
41
+ }),
42
+ ]),
43
+ id: z.string(),
44
+ jdbcConnectionString: z.optional(z.string()),
45
+ lastStateError: z.optional(z.object({ error: z.string(), timestamp: z.number() })),
46
+ modifiedAt: z.string(),
47
+ modifiedBy: z.string(),
48
+ name: z.string(),
49
+ numberOfEngines: z.number().check(z.int(), z.minimum(0)),
50
+ primaryCatalog: z.optional(z.string()),
51
+ projectStore: z.string(),
52
+ state: z.enum([
53
+ "ACTIVATING",
54
+ "ACTIVE",
55
+ "ARCHIVED",
56
+ "ARCHIVING",
57
+ "CREATING",
58
+ "DEACTIVATING",
59
+ "INACTIVE",
60
+ "RESTORING",
61
+ ]),
62
+ type: z.enum(["QUERY_ENGINE"]),
63
+ });
64
+ export const projectPropertiesCodec = z.codec(sharedProjectPropertiesInSchema, z.extend(z.omit(sharedProjectPropertiesInSchema, { createdAt: true, modifiedAt: true }), {
65
+ createdAt: z.instanceof(Date),
66
+ modifiedAt: z.instanceof(Date),
67
+ }), {
68
+ decode(v) {
69
+ const { createdAt, modifiedAt, ...rest } = v;
70
+ return {
71
+ ...rest,
72
+ createdAt: new Date(createdAt),
73
+ modifiedAt: new Date(modifiedAt),
74
+ };
75
+ },
76
+ encode(v) {
77
+ const { createdAt, modifiedAt, ...rest } = v;
78
+ return {
79
+ ...rest,
80
+ createdAt: createdAt.toString(),
81
+ modifiedAt: modifiedAt.toString(),
82
+ };
83
+ },
84
+ });
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 (a-z), contain only lowercase letters, numbers, and hyphens, and cannot end with a hyphen"), z.refine((val) => !val.includes("dremio") && !val.includes("ssl"), "Project name cannot contain the words 'dremio' or 'ssl'")),
87
+ }));
88
+ //# sourceMappingURL=projectPropertiesCodec.js.map
@@ -0,0 +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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E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CACpB,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,4CAA4C,CAAC,EAC5D,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,4CAA4C,CAAC,EAC7D,CAAC,CAAC,KAAK,CACL,2BAA2B,EAC3B,iIAAiI,CAClI,EACD,CAAC,CAAC,MAAM,CACN,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EACxD,yDAAyD,CAC1D,CACF;CACF,CAAC,CACH,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 (a-z), contain only lowercase letters, numbers, and hyphens, and cannot end with a hyphen\",\n ),\n z.refine(\n (val) => !val.includes(\"dremio\") && !val.includes(\"ssl\"),\n \"Project name cannot contain the words 'dremio' or 'ssl'\",\n ),\n ),\n }),\n);\n"]}
@@ -0,0 +1 @@
1
+ export type ConflictResolver<T, C> = (local: T, remote: T, changes: C) => T | null | PromiseLike<T | null>;
@@ -0,0 +1,17 @@
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
+ export {};
17
+ //# sourceMappingURL=ConflictResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConflictResolver.js","sourceRoot":"","sources":["../../src/common/ConflictResolver.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\nexport type ConflictResolver<T, C> = (\n local: T,\n remote: T,\n changes: C,\n) => T | null | PromiseLike<T | null>;\n"]}
@@ -64,7 +64,9 @@ export const tokenInvalidError = new Problem({
64
64
  title: "The provided authentication token was rejected because it was invalid or may have expired.",
65
65
  type: "https://api.dremio.dev/problems/auth/token-invalid",
66
66
  });
67
- const isApiV1Error = (body) => typeof body === "object" && Object.prototype.hasOwnProperty.call(body, "errorMessage");
67
+ const isApiV1Error = (body) => typeof body === "object" &&
68
+ body !== null &&
69
+ Object.prototype.hasOwnProperty.call(body, "errorMessage");
68
70
  export const isProblem = (body) => body != null && typeof body === "object" && "type" in body && "title" in body;
69
71
  export const isValidationProblem = (body) => isProblem(body) && body.title === "https://api.dremio.dev/problems/validation-problem";
70
72
  //# s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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 { Problem, ValidationProblem } from \"./Problem.ts\";\nimport { RateLimitError } from \"./problems.ts\";\n\nconst extractResponseBody = async (res: Response) => {\n if (res.headers.get(\"content-type\")?.includes(\"application/json\")) {\n return (await res.json()) as Promise<unknown>;\n } else {\n return await res.text();\n }\n};\n\nexport class HttpError extends Error {\n readonly status: number;\n readonly body: ApiV1Error | Problem | ValidationProblem | string;\n\n constructor(status: number, body: unknown) {\n if (status === 429) {\n const err = new RateLimitError();\n super(err.title);\n this.body = err;\n } else if (isApiV1Error(body)) {\n super(body.errorMessage);\n this.body = body;\n } else if (isProblem(body)) {\n super(body.title);\n if (isValidationProblem(body)) {\n this.body = new ValidationProblem(body.errors);\n } else {\n this.body = new Problem(body);\n }\n } else if (typeof body === \"string\") {\n super(body);\n this.body = body;\n } else {\n super(\"An unexpected error occurred\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n this.body = body as any;\n }\n\n this.status = status;\n }\n\n static async fromResponse(res: Response) {\n return new HttpError(res.status, await extractResponseBody(res));\n }\n}\n\nexport const tokenInvalidError = new Problem({\n title:\n \"The provided authentication token was rejected because it was invalid or may have expired.\",\n type: \"https://api.dremio.dev/problems/auth/token-invalid\",\n});\n\ntype ApiV1Error = {\n errorMessage: string;\n moreInfo?: string;\n};\n\nconst isApiV1Error = (body: unknown): body is ApiV1Error =>\n typeof body === \"object\" && Object.prototype.hasOwnProperty.call(body, \"errorMessage\");\n\nexport const isProblem = (body: unknown): body is Problem =>\n body != null && typeof body === \"object\" && \"type\" in body && \"title\" in body;\n\nexport const isValidationProblem = (body: unknown): body is ValidationProblem =>\n isProblem(body) && body.title === \"https://api.dremio.dev/problems/validation-problem\";\n"]}
1
+ {"version":3,"file":"HttpError.js","sourceRoot":"","sources":["../../src/common/HttpError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,mBAAmB,GAAG,KAAK,EAAE,GAAa,EAAE,EAAE;IAClD,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAClE,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAqB,CAAC;IAChD,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,MAAM,CAAS;IACf,IAAI,CAAoD;IAEjE,YAAY,MAAc,EAAE,IAAa;QACvC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACjB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAClB,CAAC;aAAM,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClB,IAAI,mBAAmB,CAAC,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AAa,EAA6B,EAAE,CAC9E,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,KAAK,oDAAoD,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 { Problem, ValidationProblem } from \"./Problem.ts\";\nimport { RateLimitError } from \"./problems.ts\";\n\nconst extractResponseBody = async (res: Response) => {\n if (res.headers.get(\"content-type\")?.includes(\"application/json\")) {\n return (await res.json()) as Promise<unknown>;\n } else {\n return await res.text();\n }\n};\n\nexport class HttpError extends Error {\n readonly status: number;\n readonly body: ApiV1Error | Problem | ValidationProblem | string;\n\n constructor(status: number, body: unknown) {\n if (status === 429) {\n const err = new RateLimitError();\n super(err.title);\n this.body = err;\n } else if (isApiV1Error(body)) {\n super(body.errorMessage);\n this.body = body;\n } else if (isProblem(body)) {\n super(body.title);\n if (isValidationProblem(body)) {\n this.body = new ValidationProblem(body.errors);\n } else {\n this.body = new Problem(body);\n }\n } else if (typeof body === \"string\") {\n super(body);\n this.body = body;\n } else {\n super(\"An unexpected error occurred\");\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any\n this.body = body as any;\n }\n\n this.status = status;\n }\n\n static async fromResponse(res: Response) {\n return new HttpError(res.status, await extractResponseBody(res));\n }\n}\n\nexport const tokenInvalidError = new Problem({\n title:\n \"The provided authentication token was rejected because it was invalid or may have expired.\",\n type: \"https://api.dremio.dev/problems/auth/token-invalid\",\n});\n\ntype ApiV1Error = {\n errorMessage: string;\n moreInfo?: string;\n};\n\nconst isApiV1Error = (body: unknown): body is ApiV1Error =>\n typeof body === \"object\" &&\n body !== null &&\n Object.prototype.hasOwnProperty.call(body, \"errorMessage\");\n\nexport const isProblem = (body: unknown): body is Problem =>\n body != null && typeof body === \"object\" && \"type\" in body && \"title\" in body;\n\nexport const isValidationProblem = (body: unknown): body is ValidationProblem =>\n isProblem(body) && body.title === \"https://api.dremio.dev/problems/validation-problem\";\n"]}
@@ -0,0 +1,3 @@
1
+ import { type Result } from "ts-results-es";
2
+ import * as z from "zod/mini";
3
+ export declare function safeParseResultToResult<T>(safeParseResult: z.core.util.SafeParseResult<T>): Result<z.core.util.SafeParseSuccess<T>["data"], z.core.util.SafeParseError<T>["error"]>;
@@ -0,0 +1,24 @@
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 { Ok, Err } from "ts-results-es";
17
+ import * as z from "zod/mini";
18
+ export function safeParseResultToResult(safeParseResult) {
19
+ if (safeParseResult.success) {
20
+ return Ok(safeParseResult.data);
21
+ }
22
+ return Err(safeParseResult.error);
23
+ }
24
+ //# sourceMappingURL=safeParseResultToResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeParseResultToResult.js","sourceRoot":"","sources":["../../src/common/safeParseResultToResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAe,EAAE,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,UAAU,uBAAuB,CACrC,eAA+C;IAE/C,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AACpC,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 Result, Ok, Err } from \"ts-results-es\";\nimport * as z from \"zod/mini\";\n\nexport function safeParseResultToResult<T>(\n safeParseResult: z.core.util.SafeParseResult<T>,\n): Result<z.core.util.SafeParseSuccess<T>[\"data\"], z.core.util.SafeParseError<T>[\"error\"]> {\n if (safeParseResult.success) {\n return Ok(safeParseResult.data);\n }\n return Err(safeParseResult.error);\n}\n"]}
@@ -1,17 +1,17 @@
1
- import type { SonarV3Config } from "../../common/Config.ts";
1
+ import type { V3Config } from "../../common/Config.ts";
2
2
  export declare class Role implements RoleProperties {
3
3
  #private;
4
4
  readonly roleReference: RoleProperties["roleReference"];
5
5
  readonly description: RoleProperties["description"];
6
6
  readonly memberCount: RoleProperties["memberCount"];
7
7
  readonly roles: RoleProperties["roles"];
8
- constructor(properties: RoleProperties, config: SonarV3Config);
8
+ constructor(properties: RoleProperties, config: V3Config);
9
9
  update(properties: {
10
10
  name?: RoleReference["name"];
11
11
  roles?: Role["roles"];
12
12
  description?: Role["description"];
13
13
  }): import("ts-results-es").AsyncResult<Role, import("../index.ts").HttpError>;
14
- static fromResource(properties: RoleEntity, config: SonarV3Config): Role;
14
+ static fromResource(properties: RoleEntity, config: V3Config): Role;
15
15
  }
16
16
  export declare class RoleReference {
17
17
  #private;
@@ -25,7 +25,7 @@ export declare class RoleReference {
25
25
  id: RoleReference["id"];
26
26
  name: RoleReference["name"];
27
27
  type: RoleReference["type"];
28
- }, config: SonarV3Config);
28
+ }, config: V3Config);
29
29
  delete(): import("ts-results-es").AsyncResult<void, import("../index.ts").HttpError>;
30
30
  }
31
31
  export type RoleProperties = {
@@ -34,7 +34,7 @@ export class Role {
34
34
  }
35
35
  update(properties) {
36
36
  return this.#config
37
- .sonarV3Request(`role/${this.roleReference.id}`, {
37
+ .v3Request(`role/${this.roleReference.id}`, {
38
38
  body: JSON.stringify({
39
39
  description: properties.description ?? this.description,
40
40
  name: properties.name ?? this.roleReference.name,
@@ -76,7 +76,7 @@ export class RoleReference {
76
76
  }
77
77
  delete() {
78
78
  return this.#config
79
- .sonarV3Request(`role/${this.id}`, { keepalive: true, method: "DELETE" })
79
+ .v3Request(`role/${this.id}`, { keepalive: true, method: "DELETE" })
80
80
  .map(() => undefined);
81
81
  }
82
82
  }