@trackunit/irisx-proxy 0.0.16 → 0.0.18
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/index.cjs.js +8 -2
- package/index.esm.js +8 -2
- package/package.json +1 -1
- package/src/useDatabricksToken.d.ts +43 -18
package/index.cjs.js
CHANGED
|
@@ -125,7 +125,7 @@ const validateAndParseResponse = (responseBody, responseSchema) => {
|
|
|
125
125
|
const parsedBody = JSON.parse(decodedBody);
|
|
126
126
|
const validationResult = responseSchema.safeParse(parsedBody);
|
|
127
127
|
if (!validationResult.success) {
|
|
128
|
-
return { error: validationResult.error };
|
|
128
|
+
return { error: { name: "Failed to parse response", message: JSON.stringify(validationResult.error, null, 2) } };
|
|
129
129
|
}
|
|
130
130
|
return { data: validationResult.data };
|
|
131
131
|
};
|
|
@@ -349,7 +349,7 @@ const useDatabricksToken = ({ domainBase, encodedClientIdSecretVaultKey, tableNa
|
|
|
349
349
|
data.append("authorization_details", authorization_details);
|
|
350
350
|
return btoa(data.toString());
|
|
351
351
|
}, [tableNames]);
|
|
352
|
-
|
|
352
|
+
const response = useIrisAppProxy({
|
|
353
353
|
requestOptions: {
|
|
354
354
|
url: `https://${domainBase}.cloud.databricks.com/oidc/v1/token`,
|
|
355
355
|
method: "POST",
|
|
@@ -361,6 +361,12 @@ const useDatabricksToken = ({ domainBase, encodedClientIdSecretVaultKey, tableNa
|
|
|
361
361
|
},
|
|
362
362
|
responseSchema: databricksTokenSchema,
|
|
363
363
|
});
|
|
364
|
+
return react.useMemo(() => ({
|
|
365
|
+
data: response.data,
|
|
366
|
+
loading: response.loading,
|
|
367
|
+
error: response.error,
|
|
368
|
+
mutate: response.mutate,
|
|
369
|
+
}), [response]);
|
|
364
370
|
};
|
|
365
371
|
|
|
366
372
|
exports.headerSchema = headerSchema;
|
package/index.esm.js
CHANGED
|
@@ -123,7 +123,7 @@ const validateAndParseResponse = (responseBody, responseSchema) => {
|
|
|
123
123
|
const parsedBody = JSON.parse(decodedBody);
|
|
124
124
|
const validationResult = responseSchema.safeParse(parsedBody);
|
|
125
125
|
if (!validationResult.success) {
|
|
126
|
-
return { error: validationResult.error };
|
|
126
|
+
return { error: { name: "Failed to parse response", message: JSON.stringify(validationResult.error, null, 2) } };
|
|
127
127
|
}
|
|
128
128
|
return { data: validationResult.data };
|
|
129
129
|
};
|
|
@@ -347,7 +347,7 @@ const useDatabricksToken = ({ domainBase, encodedClientIdSecretVaultKey, tableNa
|
|
|
347
347
|
data.append("authorization_details", authorization_details);
|
|
348
348
|
return btoa(data.toString());
|
|
349
349
|
}, [tableNames]);
|
|
350
|
-
|
|
350
|
+
const response = useIrisAppProxy({
|
|
351
351
|
requestOptions: {
|
|
352
352
|
url: `https://${domainBase}.cloud.databricks.com/oidc/v1/token`,
|
|
353
353
|
method: "POST",
|
|
@@ -359,6 +359,12 @@ const useDatabricksToken = ({ domainBase, encodedClientIdSecretVaultKey, tableNa
|
|
|
359
359
|
},
|
|
360
360
|
responseSchema: databricksTokenSchema,
|
|
361
361
|
});
|
|
362
|
+
return useMemo(() => ({
|
|
363
|
+
data: response.data,
|
|
364
|
+
loading: response.loading,
|
|
365
|
+
error: response.error,
|
|
366
|
+
mutate: response.mutate,
|
|
367
|
+
}), [response]);
|
|
362
368
|
};
|
|
363
369
|
|
|
364
370
|
export { headerSchema, irisAppProxySchema, useDatabricksToken, useIrisAppProxy };
|
package/package.json
CHANGED
|
@@ -14,22 +14,47 @@ interface UseDatabricksTokenProps {
|
|
|
14
14
|
* This key must be set up and stored in advance to successfully authenticate.
|
|
15
15
|
* @param {string[]} tableNames - An array of table names that the token will grant access to.
|
|
16
16
|
*/
|
|
17
|
-
export declare const useDatabricksToken: ({ domainBase, encodedClientIdSecretVaultKey, tableNames, }: UseDatabricksTokenProps) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
export declare const useDatabricksToken: ({ domainBase, encodedClientIdSecretVaultKey, tableNames, }: UseDatabricksTokenProps) => {
|
|
18
|
+
data: {
|
|
19
|
+
access_token: string;
|
|
20
|
+
authorization_details: {
|
|
21
|
+
type: string;
|
|
22
|
+
securable_type: string;
|
|
23
|
+
securable_object_name: string;
|
|
24
|
+
operation: string;
|
|
25
|
+
annotations: {
|
|
26
|
+
onlineViewName: string;
|
|
27
|
+
onlineViewId: string;
|
|
28
|
+
onlineViewMetastoreId: string;
|
|
29
|
+
onlineViewClusterId: string;
|
|
30
|
+
};
|
|
31
|
+
}[];
|
|
32
|
+
scope: string;
|
|
33
|
+
token_type: string;
|
|
34
|
+
expires_in: number;
|
|
35
|
+
} | null;
|
|
36
|
+
loading: boolean;
|
|
37
|
+
error: import("./useIrisAppProxy").ProxyError | null;
|
|
38
|
+
mutate: (request?: import("./schema").IrisAppProxyRequestOptions) => Promise<{
|
|
39
|
+
data?: {
|
|
40
|
+
access_token: string;
|
|
41
|
+
authorization_details: {
|
|
42
|
+
type: string;
|
|
43
|
+
securable_type: string;
|
|
44
|
+
securable_object_name: string;
|
|
45
|
+
operation: string;
|
|
46
|
+
annotations: {
|
|
47
|
+
onlineViewName: string;
|
|
48
|
+
onlineViewId: string;
|
|
49
|
+
onlineViewMetastoreId: string;
|
|
50
|
+
onlineViewClusterId: string;
|
|
51
|
+
};
|
|
52
|
+
}[];
|
|
53
|
+
scope: string;
|
|
54
|
+
token_type: string;
|
|
55
|
+
expires_in: number;
|
|
56
|
+
} | undefined;
|
|
57
|
+
error?: import("./useIrisAppProxy").ProxyError;
|
|
58
|
+
} | undefined>;
|
|
59
|
+
};
|
|
35
60
|
export {};
|