@dremio/js-sdk 0.30.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/Project.d.ts +30 -24
- package/dist/cloud/projects/Project.js +25 -1
- package/dist/cloud/projects/Project.js.map +1 -1
- package/dist/cloud/projects/ProjectsResource.d.ts +3 -1
- package/dist/cloud/projects/ProjectsResource.js +10 -3
- package/dist/cloud/projects/ProjectsResource.js.map +1 -1
- package/dist/cloud/projects/projectPropertiesCodec.d.ts +122 -0
- package/dist/cloud/projects/projectPropertiesCodec.js +109 -0
- package/dist/cloud/projects/projectPropertiesCodec.js.map +1 -0
- package/dist/cloud/replaceOriginResource.d.ts +6 -0
- package/dist/cloud/replaceOriginResource.js +34 -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/common/ConflictResolver.d.ts +1 -0
- package/dist/common/ConflictResolver.js +17 -0
- package/dist/common/ConflictResolver.js.map +1 -0
- package/dist/common/HttpError.js +3 -1
- package/dist/common/HttpError.js.map +1 -1
- package/dist/common/safeParseResultToResult.d.ts +3 -0
- package/dist/common/safeParseResultToResult.js +24 -0
- package/dist/common/safeParseResultToResult.js.map +1 -0
- package/dist/enterprise/Dremio.d.ts +12 -5
- package/dist/enterprise/roles/Role.d.ts +4 -4
- package/dist/enterprise/roles/Role.js +2 -2
- package/dist/enterprise/roles/Role.js.map +1 -1
- package/dist/enterprise/roles/RoleReference.d.ts +10 -0
- package/dist/enterprise/roles/RoleReference.js +22 -0
- package/dist/enterprise/roles/RoleReference.js.map +1 -0
- package/dist/enterprise/roles/RolesResource.d.ts +2 -2
- package/dist/enterprise/roles/RolesResource.js +3 -3
- package/dist/enterprise/roles/RolesResource.js.map +1 -1
- package/dist/enterprise/scripts/EnterpriseScript.d.ts +26 -20
- package/dist/enterprise/scripts/EnterpriseScript.js +47 -14
- package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
- package/dist/enterprise/scripts/EnterpriseScriptsResource.d.ts +4 -2
- package/dist/enterprise/scripts/EnterpriseScriptsResource.js +4 -2
- package/dist/enterprise/scripts/EnterpriseScriptsResource.js.map +1 -1
- package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.d.ts +32 -0
- package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.js +51 -0
- package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.js.map +1 -0
- package/dist/enterprise/users/EnterpriseUser.d.ts +40 -0
- package/dist/enterprise/users/EnterpriseUser.js +23 -0
- package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
- package/dist/enterprise/users/EnterpriseUsersResource.d.ts +6 -0
- package/dist/enterprise/users/EnterpriseUsersResource.js +28 -1
- package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
- 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/dist/oss/jobs/JobsResource.d.ts +41 -3
- package/dist/oss/jobs/JobsResource.js +1 -1
- package/dist/oss/jobs/JobsResource.js.map +1 -1
- package/dist/oss/jobs/listJobs.d.ts +82 -6
- package/dist/oss/jobs/listJobs.js +3 -24
- package/dist/oss/jobs/listJobs.js.map +1 -1
- package/dist/oss/scripts/Script.d.ts +33 -41
- package/dist/oss/scripts/Script.js +35 -42
- package/dist/oss/scripts/Script.js.map +1 -1
- package/dist/oss/scripts/ScriptLike.d.ts +16 -0
- package/dist/oss/scripts/ScriptLike.js +17 -0
- package/dist/oss/scripts/ScriptLike.js.map +1 -0
- package/dist/oss/scripts/ScriptsResource.d.ts +4 -2
- package/dist/oss/scripts/ScriptsResource.js +4 -2
- package/dist/oss/scripts/ScriptsResource.js.map +1 -1
- package/dist/oss/scripts/scriptPropertiesCodec.d.ts +29 -0
- package/dist/oss/scripts/scriptPropertiesCodec.js +78 -0
- package/dist/oss/scripts/scriptPropertiesCodec.js.map +1 -0
- package/package.json +1 -1
- package/dist/cloud/projects/utils.d.ts +0 -2
- package/dist/cloud/projects/utils.js +0 -37
- package/dist/cloud/projects/utils.js.map +0 -1
|
@@ -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,109 @@
|
|
|
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, 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
|
+
})),
|
|
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
|
+
];
|
|
109
|
+
//# 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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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,34 @@
|
|
|
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 = /^(?<resource>[^.]+)\.(?:(?<region>[^.]+)\.)?dremio\.cloud$/;
|
|
17
|
+
const daasEnginePattern = /^dcs-aws-\d+-ns\.(?<resource>[^.]+)\.drem\.io$/;
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export function _replaceOriginResource(origin, resource) {
|
|
23
|
+
let match;
|
|
24
|
+
if ((match = origin.match(prodLikePattern))) {
|
|
25
|
+
return match.groups["region"]
|
|
26
|
+
? `${resource}.${match.groups["region"]}.dremio.cloud`
|
|
27
|
+
: `${resource}.dremio.cloud`;
|
|
28
|
+
}
|
|
29
|
+
if ((match = origin.match(daasEnginePattern))) {
|
|
30
|
+
return `${match.groups["buildPrefix"]}${resource}.drem.io`;
|
|
31
|
+
}
|
|
32
|
+
return origin;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=replaceOriginResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceOriginResource.js","sourceRoot":"","sources":["../../src/cloud/replaceOriginResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,eAAe,GAAG,4DAA4D,CAAC;AACrF,MAAM,iBAAiB,GAAG,gDAAgD,CAAC;AAE3E;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwB,EAAE,QAAgB;IAC/E,IAAI,KAAK,CAAC;IAEV,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC,MAAO,CAAC,QAAQ,CAAC;YAC5B,CAAC,CAAC,GAAG,QAAQ,IAAI,KAAK,CAAC,MAAO,CAAC,QAAQ,CAAC,eAAe;YACvD,CAAC,CAAC,GAAG,QAAQ,eAAe,CAAC;IACjC,CAAC;IAED,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC;QAC9C,OAAO,GAAG,KAAK,CAAC,MAAO,CAAC,aAAa,CAAC,GAAG,QAAQ,UAAU,CAAC;IAC9D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,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\n/* eslint-disable regexp/no-unused-capturing-group */\n\nimport type { Config } from \"../common/Config.ts\";\n\nconst prodLikePattern = /^(?<resource>[^.]+)\\.(?:(?<region>[^.]+)\\.)?dremio\\.cloud$/;\nconst daasEnginePattern = /^dcs-aws-\\d+-ns\\.(?<resource>[^.]+)\\.drem\\.io$/;\n\n/**\n * @hidden\n * @internal\n */\nexport function _replaceOriginResource(origin: Config[\"origin\"], resource: string) {\n let match;\n\n if ((match = origin.match(prodLikePattern))) {\n return match.groups![\"region\"]\n ? `${resource}.${match.groups![\"region\"]}.dremio.cloud`\n : `${resource}.dremio.cloud`;\n }\n\n if ((match = origin.match(daasEnginePattern))) {\n return `${match.groups![\"buildPrefix\"]}${resource}.drem.io`;\n }\n\n return 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"]}
|
|
@@ -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"]}
|
package/dist/common/HttpError.js
CHANGED
|
@@ -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" &&
|
|
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
|
//# sourceMappingURL=HttpError.js.map
|
|
@@ -1 +1 @@
|
|
|
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,CA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CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAmB,EAAE,CAC1D,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,CAAC;AAEhF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAa,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,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"]}
|
|
@@ -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
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type {
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
.
|
|
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
|
-
.
|
|
79
|
+
.v3Request(`role/${this.id}`, { keepalive: true, method: "DELETE" })
|
|
80
80
|
.map(() => undefined);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../../src/enterprise/roles/Role.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,OAAO,IAAI;IACN,aAAa,CAAkC;IAC/C,WAAW,CAAgC;IAC3C,WAAW,CAAgC;IAC3C,KAAK,CAA0B;IAE/B,OAAO,
|
|
1
|
+
{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../../src/enterprise/roles/Role.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,OAAO,IAAI;IACN,aAAa,CAAkC;IAC/C,WAAW,CAAgC;IA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AC1D,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;QACnE,OAAO,IAAI,IAAI,CACb;YACE,GAAG,IAAI;YACP,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;YACrD,aAAa,EAAE,IAAI,aAAa,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC;YAC5D,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;SAC1F,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,aAAa;IACf,EAAE,CAAS;IACX,IAAI,CAAS;IAEtB;;OAEG;IACM,IAAI,CAAqB;IAEzB,OAAO,CAAW;IAE3B,YACE,UAIC,EACD,MAAgB;QAEhB,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,QAAQ,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;aACnE,GAAG,CAAC,GAAG,EAAE,CAAC,SAAiB,CAAC,CAAC;IAClC,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 { V3Config } from \"../../common/Config.ts\";\n\nexport class Role implements RoleProperties {\n readonly roleReference: RoleProperties[\"roleReference\"];\n readonly description: RoleProperties[\"description\"];\n readonly memberCount: RoleProperties[\"memberCount\"];\n readonly roles: RoleProperties[\"roles\"];\n\n readonly #config: V3Config;\n\n constructor(properties: RoleProperties, config: V3Config) {\n this.roleReference = properties.roleReference;\n\n this.description = properties.description;\n\n /**\n * Number of users and roles that are members of the role\n */\n this.memberCount = properties.memberCount;\n\n /**\n * Information about the roles to which the role belong\n */\n this.roles = properties.roles;\n\n this.#config = config;\n }\n\n update(properties: {\n name?: RoleReference[\"name\"];\n roles?: Role[\"roles\"];\n description?: Role[\"description\"];\n }) {\n return this.#config\n .v3Request(`role/${this.roleReference.id}`, {\n body: JSON.stringify({\n description: properties.description ?? this.description,\n name: properties.name ?? this.roleReference.name,\n roles: properties.roles?.map((ref) => ref.id) || this.roles,\n }),\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<RoleEntity>)\n .map((roleEntity) => Role.fromResource(roleEntity, this.#config));\n }\n\n static fromResource(properties: RoleEntity, config: V3Config) {\n const { description, id, name, roles, type, ...rest } = properties;\n return new Role(\n {\n ...rest,\n description: description?.length ? description : null,\n roleReference: new RoleReference({ id, name, type }, config),\n roles: roles.map((roleReferenceEntity) => new RoleReference(roleReferenceEntity, config)),\n },\n config,\n );\n }\n}\n\nexport class RoleReference {\n readonly id: string;\n readonly name: string;\n\n /**\n * Origin of the role\n */\n readonly type: RoleEntity[\"type\"];\n\n readonly #config: V3Config;\n\n constructor(\n properties: {\n id: RoleReference[\"id\"];\n name: RoleReference[\"name\"];\n type: RoleReference[\"type\"];\n },\n config: V3Config,\n ) {\n this.id = properties.id;\n this.name = properties.name;\n this.type = properties.type;\n this.#config = config;\n }\n\n delete() {\n return this.#config\n .v3Request(`role/${this.id}`, { keepalive: true, method: \"DELETE\" })\n .map(() => undefined as void);\n }\n}\n\nexport type RoleProperties = {\n readonly roleReference: RoleReference;\n readonly description: string | null;\n readonly memberCount: number;\n readonly roles: RoleReference[];\n};\n\nexport type RoleEntity = {\n id: string;\n name: string;\n type: \"INTERNAL\" | \"EXTERNAL\" | \"SYSTEM\";\n roles: RoleEntity[];\n memberCount: number;\n description: string;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
export declare const roleReferenceSchema: z.ZodMiniObject<{
|
|
3
|
+
id: z.ZodMiniString<string>;
|
|
4
|
+
name: z.ZodMiniString<string>;
|
|
5
|
+
type: z.ZodMiniEnum<{
|
|
6
|
+
INTERNAL: "INTERNAL";
|
|
7
|
+
EXTERNAL: "EXTERNAL";
|
|
8
|
+
SYSTEM: "SYSTEM";
|
|
9
|
+
}>;
|
|
10
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export const roleReferenceSchema = z.object({
|
|
18
|
+
id: z.string(),
|
|
19
|
+
name: z.string(),
|
|
20
|
+
type: z.enum(["INTERNAL", "EXTERNAL", "SYSTEM"]),
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=RoleReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoleReference.js","sourceRoot":"","sources":["../../../src/enterprise/roles/RoleReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;CACjD,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 * as z from \"zod/mini\";\n\nexport const roleReferenceSchema = z.object({\n id: z.string(),\n name: z.string(),\n type: z.enum([\"INTERNAL\", \"EXTERNAL\", \"SYSTEM\"]),\n});\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { V3Config } from "../../common/Config.ts";
|
|
2
2
|
import { Role } from "./Role.ts";
|
|
3
3
|
import type { SignalParam } from "../../common/Params.ts";
|
|
4
4
|
export declare class RolesResource {
|
|
5
5
|
#private;
|
|
6
|
-
constructor(config:
|
|
6
|
+
constructor(config: V3Config);
|
|
7
7
|
list(): {
|
|
8
8
|
data(): AsyncGenerator<Role, void, unknown>;
|
|
9
9
|
getPage: ({ signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
|