@datalayer/core 0.0.15 → 0.0.16
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/lib/hooks/useCache.js +6 -1
- package/package.json +1 -1
- package/lib/sdk/index.d.ts +0 -27
- package/lib/sdk/index.js +0 -33
package/lib/hooks/useCache.js
CHANGED
|
@@ -696,6 +696,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
696
696
|
* ```
|
|
697
697
|
*/
|
|
698
698
|
const useLogin = () => {
|
|
699
|
+
const iamStore = useIAMStore();
|
|
699
700
|
return useMutation({
|
|
700
701
|
mutationFn: async ({ handle, password, }) => {
|
|
701
702
|
return requestDatalayer({
|
|
@@ -704,7 +705,11 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
704
705
|
body: { handle, password },
|
|
705
706
|
});
|
|
706
707
|
},
|
|
707
|
-
onSuccess: () => {
|
|
708
|
+
onSuccess: async (resp) => {
|
|
709
|
+
// Set the token in IAM state
|
|
710
|
+
if (resp.token) {
|
|
711
|
+
await iamStore.refreshUserByToken(resp.token);
|
|
712
|
+
}
|
|
708
713
|
// Invalidate all queries on successful login
|
|
709
714
|
queryClient.invalidateQueries();
|
|
710
715
|
},
|
package/package.json
CHANGED
package/lib/sdk/index.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main SDK entry point for the Datalayer platform.
|
|
3
|
-
*
|
|
4
|
-
* This module provides the unified DatalayerSDK class with a flat, intuitive API
|
|
5
|
-
* for all Datalayer platform services. The SDK uses TypeScript mixins to provide
|
|
6
|
-
* excellent discoverability and ease of use.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import { DatalayerSDK } from '@datalayer/core/sdk';
|
|
11
|
-
*
|
|
12
|
-
* const sdk = new DatalayerSDK({
|
|
13
|
-
* token: 'your-api-token',
|
|
14
|
-
* baseUrl: 'https://prod1.datalayer.run'
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* // Flat, intuitive API - all methods directly accessible
|
|
18
|
-
* const user = await sdk.whoami();
|
|
19
|
-
* const environments = await sdk.listEnvironments();
|
|
20
|
-
* const runtime = await sdk.createRuntime(config);
|
|
21
|
-
* const notebook = await sdk.createNotebook(data);
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @module sdk
|
|
25
|
-
*/
|
|
26
|
-
export { DatalayerClient, type DatalayerClientConfig } from '../client';
|
|
27
|
-
export * from '../stateful';
|
package/lib/sdk/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Main SDK entry point for the Datalayer platform.
|
|
7
|
-
*
|
|
8
|
-
* This module provides the unified DatalayerSDK class with a flat, intuitive API
|
|
9
|
-
* for all Datalayer platform services. The SDK uses TypeScript mixins to provide
|
|
10
|
-
* excellent discoverability and ease of use.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { DatalayerSDK } from '@datalayer/core/sdk';
|
|
15
|
-
*
|
|
16
|
-
* const sdk = new DatalayerSDK({
|
|
17
|
-
* token: 'your-api-token',
|
|
18
|
-
* baseUrl: 'https://prod1.datalayer.run'
|
|
19
|
-
* });
|
|
20
|
-
*
|
|
21
|
-
* // Flat, intuitive API - all methods directly accessible
|
|
22
|
-
* const user = await sdk.whoami();
|
|
23
|
-
* const environments = await sdk.listEnvironments();
|
|
24
|
-
* const runtime = await sdk.createRuntime(config);
|
|
25
|
-
* const notebook = await sdk.createNotebook(data);
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @module sdk
|
|
29
|
-
*/
|
|
30
|
-
// Export the main Client class with flat API
|
|
31
|
-
export { DatalayerClient } from '../client';
|
|
32
|
-
// Export stateful modules for advanced use cases
|
|
33
|
-
export * from '../stateful';
|