@datalayer/core 0.0.26 → 1.0.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/lib/api/index.d.ts +1 -1
- package/lib/api/index.js +1 -1
- package/lib/client/utils/spacerUtils.d.ts +2 -2
- package/lib/client/utils/spacerUtils.js +4 -4
- package/lib/components/auth/Login.d.ts +4 -0
- package/lib/components/auth/Login.js +8 -2
- package/lib/components/auth/Login.stories.d.ts +1 -0
- package/lib/components/progress/ConsumptionBar.js +7 -7
- package/lib/components/progress/CreditsIndicator.d.ts +7 -1
- package/lib/components/progress/CreditsIndicator.js +4 -2
- package/lib/components/{screenshot/ScreenCapture.d.ts → screencapture/Screencapture.d.ts} +5 -5
- package/lib/components/{screenshot/ScreenCapture.js → screencapture/Screencapture.js} +2 -2
- package/lib/components/screencapture/ScreencaptureButton.d.ts +3 -0
- package/lib/components/{screenshot/ScreenCaptureButton.js → screencapture/ScreencaptureButton.js} +8 -8
- package/lib/components/screencapture/index.d.ts +2 -0
- package/lib/components/{screenshot → screencapture}/index.js +2 -2
- package/lib/components/storage/ContentsBrowser.js +2 -2
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/layouts/{LayoutScreenshot.css → LayoutScreencapture.css} +2 -2
- package/lib/hooks/layouts/LayoutScreencapture.d.ts +3 -0
- package/lib/hooks/layouts/{LayoutScreenshot.js → LayoutScreencapture.js} +14 -14
- package/lib/hooks/layouts/index.d.ts +1 -1
- package/lib/hooks/layouts/index.js +1 -1
- package/lib/hooks/useCache.d.ts +12 -2
- package/lib/hooks/useCache.js +180 -68
- package/lib/hooks/useCellOutputshot.js +2 -2
- package/lib/hooks/useScreencapture.d.ts +18 -0
- package/lib/hooks/useScreencapture.js +53 -0
- package/lib/models/CreditsDTO.d.ts +1 -1
- package/lib/models/CreditsDTO.js +1 -1
- package/lib/models/Datasource.d.ts +4 -4
- package/lib/models/Datasource.js +7 -7
- package/lib/models/EnvironmentDTO.d.ts +3 -3
- package/lib/models/EnvironmentDTO.js +3 -3
- package/lib/models/HealthCheck.d.ts +2 -2
- package/lib/models/HealthCheck.js +2 -2
- package/lib/models/IAMProviderUsers.d.ts +11 -0
- package/lib/models/IAMProvidersSpecs.d.ts +2 -1
- package/lib/models/IAMProvidersSpecs.js +14 -0
- package/lib/models/ItemDTO.d.ts +3 -3
- package/lib/models/ItemDTO.js +10 -10
- package/lib/models/LexicalDTO.d.ts +3 -3
- package/lib/models/LexicalDTO.js +4 -4
- package/lib/models/NotebookDTO.d.ts +3 -3
- package/lib/models/NotebookDTO.js +6 -6
- package/lib/models/Page.js +1 -1
- package/lib/models/PageTag.d.ts +1 -1
- package/lib/models/PageTag.js +21 -0
- package/lib/models/RuntimeDTO.d.ts +4 -4
- package/lib/models/RuntimeDTO.js +9 -9
- package/lib/models/RuntimeSnapshotDTO.d.ts +3 -3
- package/lib/models/RuntimeSnapshotDTO.js +7 -7
- package/lib/models/Secret.d.ts +4 -4
- package/lib/models/Secret.js +7 -7
- package/lib/models/Space.js +3 -0
- package/lib/models/SpaceDTO.d.ts +3 -3
- package/lib/models/SpaceDTO.js +14 -14
- package/lib/models/UserDTO.d.ts +2 -2
- package/lib/models/UserDTO.js +2 -2
- package/lib/state/substates/LayoutState.d.ts +5 -5
- package/lib/state/substates/LayoutState.js +3 -3
- package/lib/theme/DatalayerTheme.js +5 -5
- package/lib/utils/Screencapture.d.ts +1 -0
- package/lib/utils/{Screenshot.js → Screencapture.js} +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/views/datasources/DatasourceNew.d.ts +7 -1
- package/lib/views/datasources/DatasourceNew.js +3 -3
- package/lib/views/datasources/Datasources.d.ts +7 -1
- package/lib/views/datasources/Datasources.js +6 -4
- package/package.json +1 -1
- package/style/screencapture/index.css +58 -0
- package/lib/components/screenshot/ScreenCaptureButton.d.ts +0 -3
- package/lib/components/screenshot/index.d.ts +0 -2
- package/lib/hooks/layouts/LayoutScreenshot.d.ts +0 -3
- package/lib/hooks/useScreenshot.d.ts +0 -18
- package/lib/hooks/useScreenshot.js +0 -53
- package/lib/utils/Screenshot.d.ts +0 -1
package/lib/hooks/useCache.js
CHANGED
|
@@ -1321,17 +1321,20 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1321
1321
|
});
|
|
1322
1322
|
};
|
|
1323
1323
|
/**
|
|
1324
|
-
* Update space with optimistic update
|
|
1324
|
+
* Update space with optimistic update.
|
|
1325
|
+
* Any extra fields (e.g. attached_agent_pod_name_s) are forwarded to the backend.
|
|
1325
1326
|
*/
|
|
1326
1327
|
const useUpdateSpace = () => {
|
|
1327
1328
|
return useMutation({
|
|
1328
1329
|
mutationFn: async (space) => {
|
|
1330
|
+
const { id, name, description, ...extraFields } = space;
|
|
1329
1331
|
return requestDatalayer({
|
|
1330
|
-
url: `${configuration.spacerRunUrl}/api/spacer/v1/spaces/${
|
|
1332
|
+
url: `${configuration.spacerRunUrl}/api/spacer/v1/spaces/${id}/users/${user?.id}`,
|
|
1331
1333
|
method: 'PUT',
|
|
1332
1334
|
body: {
|
|
1333
|
-
name
|
|
1334
|
-
description
|
|
1335
|
+
name,
|
|
1336
|
+
description,
|
|
1337
|
+
...extraFields,
|
|
1335
1338
|
},
|
|
1336
1339
|
});
|
|
1337
1340
|
},
|
|
@@ -1348,6 +1351,25 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1348
1351
|
},
|
|
1349
1352
|
});
|
|
1350
1353
|
};
|
|
1354
|
+
/**
|
|
1355
|
+
* Delete a space and all its contents.
|
|
1356
|
+
*/
|
|
1357
|
+
const useDeleteSpace = () => {
|
|
1358
|
+
return useMutation({
|
|
1359
|
+
mutationFn: async (spaceUid) => {
|
|
1360
|
+
return requestDatalayer({
|
|
1361
|
+
url: `${configuration.spacerRunUrl}/api/spacer/v1/spaces/${spaceUid}`,
|
|
1362
|
+
method: 'DELETE',
|
|
1363
|
+
});
|
|
1364
|
+
},
|
|
1365
|
+
onSuccess: () => {
|
|
1366
|
+
// Invalidate all space queries
|
|
1367
|
+
queryClient.invalidateQueries({
|
|
1368
|
+
queryKey: queryKeys.spaces.all(),
|
|
1369
|
+
});
|
|
1370
|
+
},
|
|
1371
|
+
});
|
|
1372
|
+
};
|
|
1351
1373
|
// ============================================================================
|
|
1352
1374
|
// Agent Spaces Hooks
|
|
1353
1375
|
// ============================================================================
|
|
@@ -1604,6 +1626,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1604
1626
|
// Map ingress URL to url for UI consistency
|
|
1605
1627
|
url: rt.ingress,
|
|
1606
1628
|
messageCount: 0, // Default for UI compatibility
|
|
1629
|
+
agent_spec_id: rt.agent_spec_id || undefined,
|
|
1607
1630
|
}));
|
|
1608
1631
|
// Set detail cache for each runtime
|
|
1609
1632
|
agentRuntimes.forEach((runtime) => {
|
|
@@ -1652,12 +1675,22 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1652
1675
|
// Map ingress URL to url for UI consistency
|
|
1653
1676
|
url: rt.ingress,
|
|
1654
1677
|
messageCount: 0,
|
|
1678
|
+
agent_spec_id: rt.agent_spec_id || undefined,
|
|
1655
1679
|
};
|
|
1656
1680
|
}
|
|
1657
1681
|
throw new Error('Failed to fetch agent runtime');
|
|
1658
1682
|
},
|
|
1659
1683
|
...DEFAULT_QUERY_OPTIONS,
|
|
1660
|
-
|
|
1684
|
+
// Poll every 5 seconds while the runtime exists. Stop polling on error
|
|
1685
|
+
// (e.g. 404 — runtime deleted, 500 — broken state) to avoid hammering the server.
|
|
1686
|
+
refetchInterval: query => {
|
|
1687
|
+
if (query.state.error)
|
|
1688
|
+
return false;
|
|
1689
|
+
return 5000;
|
|
1690
|
+
},
|
|
1691
|
+
// Don't retry failed detail requests. The refetchInterval handles
|
|
1692
|
+
// periodic re-checks, so retrying only generates duplicate failing requests.
|
|
1693
|
+
retry: false,
|
|
1661
1694
|
enabled: !!podName,
|
|
1662
1695
|
});
|
|
1663
1696
|
};
|
|
@@ -1669,10 +1702,12 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1669
1702
|
method: 'POST',
|
|
1670
1703
|
body: {
|
|
1671
1704
|
environment_name: data.environmentName || 'ai-agents-env',
|
|
1672
|
-
given_name: data.givenName || 'Agent
|
|
1705
|
+
given_name: data.givenName || 'Agent',
|
|
1673
1706
|
credits_limit: data.creditsLimit || 10,
|
|
1674
1707
|
type: data.type || 'notebook',
|
|
1675
1708
|
editor_variant: data.editorVariant || 'none',
|
|
1709
|
+
enable_codemode: data.enableCodemode ?? false,
|
|
1710
|
+
agent_spec_id: data.agentSpecId || undefined,
|
|
1676
1711
|
},
|
|
1677
1712
|
});
|
|
1678
1713
|
},
|
|
@@ -1690,6 +1725,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1690
1725
|
// Map ingress URL to url for UI consistency
|
|
1691
1726
|
url: rt.ingress,
|
|
1692
1727
|
messageCount: 0,
|
|
1728
|
+
agent_spec_id: rt.agent_spec_id || undefined,
|
|
1693
1729
|
});
|
|
1694
1730
|
// Invalidate list
|
|
1695
1731
|
queryClient.invalidateQueries({
|
|
@@ -1710,10 +1746,21 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
1710
1746
|
method: 'DELETE',
|
|
1711
1747
|
});
|
|
1712
1748
|
},
|
|
1713
|
-
onSuccess: () => {
|
|
1714
|
-
//
|
|
1749
|
+
onSuccess: (_data, podName) => {
|
|
1750
|
+
// Cancel any in-flight queries for the deleted runtime so they
|
|
1751
|
+
// don't re-fetch a resource that no longer exists.
|
|
1752
|
+
queryClient.cancelQueries({
|
|
1753
|
+
queryKey: queryKeys.agentRuntimes.detail(podName),
|
|
1754
|
+
});
|
|
1755
|
+
// Remove the detail cache entry immediately — prevents React
|
|
1756
|
+
// Query from triggering a stale re-fetch while the component
|
|
1757
|
+
// unmounts.
|
|
1758
|
+
queryClient.removeQueries({
|
|
1759
|
+
queryKey: queryKeys.agentRuntimes.detail(podName),
|
|
1760
|
+
});
|
|
1761
|
+
// Invalidate the list so the sidebar refreshes.
|
|
1715
1762
|
queryClient.invalidateQueries({
|
|
1716
|
-
queryKey: queryKeys.agentRuntimes.
|
|
1763
|
+
queryKey: queryKeys.agentRuntimes.lists(),
|
|
1717
1764
|
});
|
|
1718
1765
|
},
|
|
1719
1766
|
});
|
|
@@ -3601,6 +3648,30 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
3601
3648
|
...DEFAULT_QUERY_OPTIONS,
|
|
3602
3649
|
});
|
|
3603
3650
|
};
|
|
3651
|
+
/**
|
|
3652
|
+
* Get default items (notebook UID & document UID) for a space / project.
|
|
3653
|
+
* Calls GET /api/spacer/v1/spaces/{spaceId}/default-items
|
|
3654
|
+
*/
|
|
3655
|
+
const useSpaceDefaultItems = (spaceId) => {
|
|
3656
|
+
return useQuery({
|
|
3657
|
+
queryKey: ['spaces', spaceId, 'default-items'],
|
|
3658
|
+
queryFn: async () => {
|
|
3659
|
+
const resp = await requestDatalayer({
|
|
3660
|
+
url: `${configuration.spacerRunUrl}/api/spacer/v1/spaces/${spaceId}/default-items`,
|
|
3661
|
+
method: 'GET',
|
|
3662
|
+
});
|
|
3663
|
+
if (resp.success) {
|
|
3664
|
+
return {
|
|
3665
|
+
defaultNotebookUid: resp.default_notebook_uid,
|
|
3666
|
+
defaultDocumentUid: resp.default_document_uid,
|
|
3667
|
+
};
|
|
3668
|
+
}
|
|
3669
|
+
throw new Error(resp.message || 'Failed to fetch default items');
|
|
3670
|
+
},
|
|
3671
|
+
enabled: !!spaceId,
|
|
3672
|
+
...DEFAULT_QUERY_OPTIONS,
|
|
3673
|
+
});
|
|
3674
|
+
};
|
|
3604
3675
|
/**
|
|
3605
3676
|
* Make item public
|
|
3606
3677
|
*/
|
|
@@ -5194,7 +5265,9 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
5194
5265
|
if (!resp.success) {
|
|
5195
5266
|
throw new Error(resp.message || 'Failed to search public items');
|
|
5196
5267
|
}
|
|
5197
|
-
return resp.items || []
|
|
5268
|
+
return (resp.items || [])
|
|
5269
|
+
.map((item) => toItem(item))
|
|
5270
|
+
.filter(Boolean);
|
|
5198
5271
|
},
|
|
5199
5272
|
});
|
|
5200
5273
|
};
|
|
@@ -5219,6 +5292,23 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
5219
5292
|
},
|
|
5220
5293
|
});
|
|
5221
5294
|
};
|
|
5295
|
+
/**
|
|
5296
|
+
* Get Google profile from access token
|
|
5297
|
+
*/
|
|
5298
|
+
const useGetGoogleProfile = () => {
|
|
5299
|
+
return useMutation({
|
|
5300
|
+
mutationFn: async (accessToken) => {
|
|
5301
|
+
const response = await fetch('https://openidconnect.googleapis.com/v1/userinfo', {
|
|
5302
|
+
method: 'GET',
|
|
5303
|
+
headers: {
|
|
5304
|
+
Accept: 'application/json',
|
|
5305
|
+
Authorization: `Bearer ${accessToken}`,
|
|
5306
|
+
},
|
|
5307
|
+
});
|
|
5308
|
+
return response.json();
|
|
5309
|
+
},
|
|
5310
|
+
});
|
|
5311
|
+
};
|
|
5222
5312
|
/**
|
|
5223
5313
|
* Get LinkedIn profile via proxy
|
|
5224
5314
|
*/
|
|
@@ -5275,68 +5365,87 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
5275
5365
|
const usePostLinkedinShareWithUpload = () => {
|
|
5276
5366
|
return useMutation({
|
|
5277
5367
|
mutationFn: async ({ linkedinUserUrn, postText, uploadObject, accessToken, }) => {
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
identifier: 'urn:li:userGeneratedContent',
|
|
5287
|
-
},
|
|
5288
|
-
],
|
|
5289
|
-
},
|
|
5290
|
-
};
|
|
5291
|
-
const registerResp = await requestDatalayer({
|
|
5292
|
-
url: `${configuration.iamRunUrl}/api/iam/v1/proxy/request`,
|
|
5293
|
-
method: 'POST',
|
|
5294
|
-
body: {
|
|
5295
|
-
request_method: 'POST',
|
|
5296
|
-
request_url: 'https://api.linkedin.com/v2/assets?action=registerUpload',
|
|
5297
|
-
request_token: accessToken,
|
|
5298
|
-
request_body: registerUploadRequest,
|
|
5299
|
-
},
|
|
5300
|
-
});
|
|
5301
|
-
const asset = registerResp.response.value.asset;
|
|
5302
|
-
const uploadUrl = registerResp.response.value.uploadMechanism['com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest'].uploadUrl;
|
|
5303
|
-
// Step 2: Upload image
|
|
5304
|
-
await requestDatalayer({
|
|
5305
|
-
url: `${configuration.iamRunUrl}/api/iam/v1/proxy/request`,
|
|
5306
|
-
method: 'POST',
|
|
5307
|
-
body: {
|
|
5308
|
-
request_method: 'PUT',
|
|
5309
|
-
request_url: uploadUrl,
|
|
5310
|
-
request_token: accessToken,
|
|
5311
|
-
request_body: {
|
|
5312
|
-
uploadURL: uploadUrl,
|
|
5313
|
-
content: uploadObject,
|
|
5314
|
-
userURN: linkedinUserUrn,
|
|
5315
|
-
},
|
|
5316
|
-
},
|
|
5317
|
-
});
|
|
5318
|
-
// Step 3: Create share with media
|
|
5319
|
-
const shareRequest = {
|
|
5320
|
-
author: linkedinUserUrn,
|
|
5321
|
-
lifecycleState: 'PUBLISHED',
|
|
5322
|
-
specificContent: {
|
|
5323
|
-
'com.linkedin.ugc.ShareContent': {
|
|
5324
|
-
shareCommentary: { text: postText },
|
|
5325
|
-
shareMediaCategory: 'IMAGE',
|
|
5326
|
-
media: [
|
|
5368
|
+
let shareRequest;
|
|
5369
|
+
if (uploadObject) {
|
|
5370
|
+
// Step 1: Register upload
|
|
5371
|
+
const registerUploadRequest = {
|
|
5372
|
+
registerUploadRequest: {
|
|
5373
|
+
recipes: ['urn:li:digitalmediaRecipe:feedshare-image'],
|
|
5374
|
+
owner: linkedinUserUrn,
|
|
5375
|
+
serviceRelationships: [
|
|
5327
5376
|
{
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
media: asset,
|
|
5331
|
-
title: { text: 'Datalayer Notebook' },
|
|
5377
|
+
relationshipType: 'OWNER',
|
|
5378
|
+
identifier: 'urn:li:userGeneratedContent',
|
|
5332
5379
|
},
|
|
5333
5380
|
],
|
|
5334
5381
|
},
|
|
5335
|
-
}
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5382
|
+
};
|
|
5383
|
+
const registerResp = await requestDatalayer({
|
|
5384
|
+
url: `${configuration.iamRunUrl}/api/iam/v1/proxy/request`,
|
|
5385
|
+
method: 'POST',
|
|
5386
|
+
body: {
|
|
5387
|
+
request_method: 'POST',
|
|
5388
|
+
request_url: 'https://api.linkedin.com/v2/assets?action=registerUpload',
|
|
5389
|
+
request_token: accessToken,
|
|
5390
|
+
request_body: registerUploadRequest,
|
|
5391
|
+
},
|
|
5392
|
+
});
|
|
5393
|
+
const asset = registerResp.response.value.asset;
|
|
5394
|
+
const uploadUrl = registerResp.response.value.uploadMechanism['com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest'].uploadUrl;
|
|
5395
|
+
// Step 2: Upload image
|
|
5396
|
+
await requestDatalayer({
|
|
5397
|
+
url: `${configuration.iamRunUrl}/api/iam/v1/proxy/request`,
|
|
5398
|
+
method: 'POST',
|
|
5399
|
+
body: {
|
|
5400
|
+
request_method: 'PUT',
|
|
5401
|
+
request_url: uploadUrl,
|
|
5402
|
+
request_token: accessToken,
|
|
5403
|
+
request_body: {
|
|
5404
|
+
uploadURL: uploadUrl,
|
|
5405
|
+
content: uploadObject,
|
|
5406
|
+
userURN: linkedinUserUrn,
|
|
5407
|
+
},
|
|
5408
|
+
},
|
|
5409
|
+
});
|
|
5410
|
+
// Step 3: Create share with media
|
|
5411
|
+
shareRequest = {
|
|
5412
|
+
author: linkedinUserUrn,
|
|
5413
|
+
lifecycleState: 'PUBLISHED',
|
|
5414
|
+
specificContent: {
|
|
5415
|
+
'com.linkedin.ugc.ShareContent': {
|
|
5416
|
+
shareCommentary: { text: postText },
|
|
5417
|
+
shareMediaCategory: 'IMAGE',
|
|
5418
|
+
media: [
|
|
5419
|
+
{
|
|
5420
|
+
status: 'READY',
|
|
5421
|
+
description: { text: 'Datalayer Notebook' },
|
|
5422
|
+
media: asset,
|
|
5423
|
+
title: { text: 'Datalayer Notebook' },
|
|
5424
|
+
},
|
|
5425
|
+
],
|
|
5426
|
+
},
|
|
5427
|
+
},
|
|
5428
|
+
visibility: {
|
|
5429
|
+
'com.linkedin.ugc.MemberNetworkVisibility': 'PUBLIC',
|
|
5430
|
+
},
|
|
5431
|
+
};
|
|
5432
|
+
}
|
|
5433
|
+
else {
|
|
5434
|
+
// Text-only share (no image upload)
|
|
5435
|
+
shareRequest = {
|
|
5436
|
+
author: linkedinUserUrn,
|
|
5437
|
+
lifecycleState: 'PUBLISHED',
|
|
5438
|
+
specificContent: {
|
|
5439
|
+
'com.linkedin.ugc.ShareContent': {
|
|
5440
|
+
shareCommentary: { text: postText },
|
|
5441
|
+
shareMediaCategory: 'NONE',
|
|
5442
|
+
},
|
|
5443
|
+
},
|
|
5444
|
+
visibility: {
|
|
5445
|
+
'com.linkedin.ugc.MemberNetworkVisibility': 'PUBLIC',
|
|
5446
|
+
},
|
|
5447
|
+
};
|
|
5448
|
+
}
|
|
5340
5449
|
return requestDatalayer({
|
|
5341
5450
|
url: `${configuration.iamRunUrl}/api/iam/v1/proxy/request`,
|
|
5342
5451
|
method: 'POST',
|
|
@@ -6353,6 +6462,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
6353
6462
|
useOAuth2AuthorizationURL,
|
|
6354
6463
|
useOAuth2AuthorizationLinkURL,
|
|
6355
6464
|
useGetGitHubProfile,
|
|
6465
|
+
useGetGoogleProfile,
|
|
6356
6466
|
useGetLinkedinProfile,
|
|
6357
6467
|
usePostLinkedinShare,
|
|
6358
6468
|
usePostLinkedinShareWithUpload,
|
|
@@ -6416,6 +6526,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
6416
6526
|
useUserSpaces,
|
|
6417
6527
|
useCreateSpace,
|
|
6418
6528
|
useUpdateSpace,
|
|
6529
|
+
useDeleteSpace,
|
|
6419
6530
|
useUpdateOrganizationSpace,
|
|
6420
6531
|
useAddMemberToOrganizationSpace,
|
|
6421
6532
|
useRemoveMemberFromOrganizationSpace,
|
|
@@ -6525,6 +6636,7 @@ export const useCache = ({ loginRoute = '/login' } = {}) => {
|
|
|
6525
6636
|
// Items (Generic)
|
|
6526
6637
|
useDeleteItem,
|
|
6527
6638
|
useSpaceItems,
|
|
6639
|
+
useSpaceDefaultItems,
|
|
6528
6640
|
useMakeItemPublic,
|
|
6529
6641
|
useMakeItemPrivate,
|
|
6530
6642
|
useSearchPublicItems,
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { useCellStore } from '../state';
|
|
7
|
-
import {
|
|
7
|
+
import { takeHTMLNodeScreencapture } from '../utils/Screencapture';
|
|
8
8
|
const useCellOutputshot = () => {
|
|
9
9
|
const [outputshot, setOutputshot] = useState('');
|
|
10
10
|
const [error, setError] = useState();
|
|
11
11
|
const { update } = useCellStore();
|
|
12
12
|
const takeOutputshot = (node) => {
|
|
13
|
-
|
|
13
|
+
takeHTMLNodeScreencapture(node)
|
|
14
14
|
.then(outputshotData => {
|
|
15
15
|
setOutputshot(outputshotData);
|
|
16
16
|
update({
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ScreencaptureContextType = {
|
|
3
|
+
closeScreencapture: () => void;
|
|
4
|
+
displayScreencapture: (nextScreencapture: any) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const ScreencaptureContext: import("react").Context<ScreencaptureContextType>;
|
|
7
|
+
export declare function useScreencapture(): ScreencaptureContextType;
|
|
8
|
+
/**
|
|
9
|
+
* The type for the Screencapture context provider.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ScreencaptureContextProvider: import("react").Provider<ScreencaptureContextType>;
|
|
12
|
+
export type IScreencaptureProviderProps = {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
zIndex?: number;
|
|
15
|
+
disableDarken?: boolean;
|
|
16
|
+
screenshotSurface?: (qfds: any) => JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
export declare function ScreencaptureProvider({ children, zIndex, disableDarken, screenshotSurface, }: IScreencaptureProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
6
|
+
import { createContext, useState, useContext } from 'react';
|
|
7
|
+
import { LayoutScreencapture } from './layouts';
|
|
8
|
+
export const ScreencaptureContext = createContext({
|
|
9
|
+
closeScreencapture: () => { },
|
|
10
|
+
displayScreencapture: (nextScreencapture) => { },
|
|
11
|
+
});
|
|
12
|
+
export function useScreencapture() {
|
|
13
|
+
const context = useContext(ScreencaptureContext);
|
|
14
|
+
if (!context)
|
|
15
|
+
throw new Error('useContext must be inside a provider with a value.');
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The type for the Screencapture context provider.
|
|
20
|
+
*/
|
|
21
|
+
export const ScreencaptureContextProvider = ScreencaptureContext.Provider;
|
|
22
|
+
export function ScreencaptureProvider({ children = null, zIndex = 9999, disableDarken = false, screenshotSurface = undefined, }) {
|
|
23
|
+
const defaultScreencaptureSurface = {
|
|
24
|
+
position: 'fixed',
|
|
25
|
+
top: 0,
|
|
26
|
+
left: 0,
|
|
27
|
+
width: '100%',
|
|
28
|
+
height: '100%',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
backgroundColor: disableDarken ? 'initial' : 'rgba(0, 0, 0, 0.5)',
|
|
33
|
+
zIndex,
|
|
34
|
+
};
|
|
35
|
+
const [screenshot, setScreencapture] = useState({
|
|
36
|
+
open: false,
|
|
37
|
+
render: (closeScreencapture) => _jsx(_Fragment, {}),
|
|
38
|
+
});
|
|
39
|
+
const displayScreencapture = (nextScreencapture) => {
|
|
40
|
+
setScreencapture({
|
|
41
|
+
open: true,
|
|
42
|
+
render: nextScreencapture,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const closeScreencapture = () => {
|
|
46
|
+
setScreencapture({
|
|
47
|
+
open: false,
|
|
48
|
+
render: (closeScreencapture) => _jsx(_Fragment, {}),
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
return (_jsxs(ScreencaptureContextProvider, { value: { closeScreencapture, displayScreencapture }, children: [_jsx(LayoutScreencapture, {}), children, screenshot.open &&
|
|
52
|
+
(screenshotSurface ? (screenshotSurface(screenshot.render(closeScreencapture))) : (_jsx("div", { style: defaultScreencaptureSurface, children: screenshot.render(closeScreencapture) })))] }));
|
|
53
|
+
}
|
|
@@ -42,7 +42,7 @@ export interface CreditsResponse {
|
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* ```typescript
|
|
45
|
-
* const credits = await
|
|
45
|
+
* const credits = await client.getCredits();
|
|
46
46
|
* console.log(`Available: ${credits.available}`);
|
|
47
47
|
* console.log(`Quota: ${credits.quota || 'unlimited'}`);
|
|
48
48
|
*
|
package/lib/models/CreditsDTO.js
CHANGED
|
@@ -13,7 +13,7 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
16
|
-
* const credits = await
|
|
16
|
+
* const credits = await client.getCredits();
|
|
17
17
|
* console.log(`Available: ${credits.available}`);
|
|
18
18
|
* console.log(`Quota: ${credits.quota || 'unlimited'}`);
|
|
19
19
|
*
|
|
@@ -126,7 +126,7 @@ export interface UpdateDatasourceResponse {
|
|
|
126
126
|
*
|
|
127
127
|
* @example
|
|
128
128
|
* ```typescript
|
|
129
|
-
* const datasource = await
|
|
129
|
+
* const datasource = await client.createDatasource({
|
|
130
130
|
* type: 'Amazon Athena',
|
|
131
131
|
* name: 'my-athena-datasource',
|
|
132
132
|
* description: 'Production Athena datasource',
|
|
@@ -141,14 +141,14 @@ export interface UpdateDatasourceResponse {
|
|
|
141
141
|
export declare class DatasourceDTO {
|
|
142
142
|
/** @internal */
|
|
143
143
|
_data: DatasourceData;
|
|
144
|
-
private
|
|
144
|
+
private _client;
|
|
145
145
|
private _deleted;
|
|
146
146
|
/**
|
|
147
147
|
* Create a Datasource instance.
|
|
148
148
|
* @param data - Datasource data from API
|
|
149
|
-
* @param
|
|
149
|
+
* @param client - Client instance
|
|
150
150
|
*/
|
|
151
|
-
constructor(data: DatasourceData,
|
|
151
|
+
constructor(data: DatasourceData, client: DatalayerClient);
|
|
152
152
|
private _checkDeleted;
|
|
153
153
|
get uid(): string;
|
|
154
154
|
get type(): DatasourceType;
|
package/lib/models/Datasource.js
CHANGED
|
@@ -25,7 +25,7 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```typescript
|
|
28
|
-
* const datasource = await
|
|
28
|
+
* const datasource = await client.createDatasource({
|
|
29
29
|
* type: 'Amazon Athena',
|
|
30
30
|
* name: 'my-athena-datasource',
|
|
31
31
|
* description: 'Production Athena datasource',
|
|
@@ -40,16 +40,16 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
40
40
|
export class DatasourceDTO {
|
|
41
41
|
/** @internal */
|
|
42
42
|
_data;
|
|
43
|
-
|
|
43
|
+
_client;
|
|
44
44
|
_deleted = false;
|
|
45
45
|
/**
|
|
46
46
|
* Create a Datasource instance.
|
|
47
47
|
* @param data - Datasource data from API
|
|
48
|
-
* @param
|
|
48
|
+
* @param client - Client instance
|
|
49
49
|
*/
|
|
50
|
-
constructor(data,
|
|
50
|
+
constructor(data, client) {
|
|
51
51
|
this._data = data;
|
|
52
|
-
this.
|
|
52
|
+
this._client = client;
|
|
53
53
|
}
|
|
54
54
|
// ========================================================================
|
|
55
55
|
// Helper Methods
|
|
@@ -108,7 +108,7 @@ export class DatasourceDTO {
|
|
|
108
108
|
*/
|
|
109
109
|
async update(updates) {
|
|
110
110
|
this._checkDeleted();
|
|
111
|
-
const updated = await this.
|
|
111
|
+
const updated = await this._client.updateDatasource(this.uid, updates);
|
|
112
112
|
return updated;
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
@@ -116,7 +116,7 @@ export class DatasourceDTO {
|
|
|
116
116
|
*/
|
|
117
117
|
async delete() {
|
|
118
118
|
this._checkDeleted();
|
|
119
|
-
await this.
|
|
119
|
+
await this._client.deleteDatasource(this.uid);
|
|
120
120
|
this._deleted = true;
|
|
121
121
|
}
|
|
122
122
|
// ========================================================================
|
|
@@ -80,7 +80,7 @@ export interface ListEnvironmentsResponse {
|
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```typescript
|
|
83
|
-
* const environments = await
|
|
83
|
+
* const environments = await client.listEnvironments();
|
|
84
84
|
* const aiEnv = environments.find(env => env.name === 'ai-env');
|
|
85
85
|
* console.log(aiEnv.title); // "AI Environment"
|
|
86
86
|
* ```
|
|
@@ -92,9 +92,9 @@ export declare class EnvironmentDTO {
|
|
|
92
92
|
* Create an Environment instance.
|
|
93
93
|
*
|
|
94
94
|
* @param data - Environment data from API
|
|
95
|
-
* @param
|
|
95
|
+
* @param _client - Client instance (not currently used but kept for consistency)
|
|
96
96
|
*/
|
|
97
|
-
constructor(data: EnvironmentData,
|
|
97
|
+
constructor(data: EnvironmentData, _client: DatalayerClient);
|
|
98
98
|
/** Human-readable title for the environment (e.g., 'AI Environment', 'Python CPU Environment'). */
|
|
99
99
|
get title(): string;
|
|
100
100
|
/** Unique name identifier for the environment (e.g., 'ai-env', 'python-cpu-env'). */
|
|
@@ -9,7 +9,7 @@ import { validateJSON } from '../api/utils/validation';
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
|
-
* const environments = await
|
|
12
|
+
* const environments = await client.listEnvironments();
|
|
13
13
|
* const aiEnv = environments.find(env => env.name === 'ai-env');
|
|
14
14
|
* console.log(aiEnv.title); // "AI Environment"
|
|
15
15
|
* ```
|
|
@@ -21,9 +21,9 @@ export class EnvironmentDTO {
|
|
|
21
21
|
* Create an Environment instance.
|
|
22
22
|
*
|
|
23
23
|
* @param data - Environment data from API
|
|
24
|
-
* @param
|
|
24
|
+
* @param _client - Client instance (not currently used but kept for consistency)
|
|
25
25
|
*/
|
|
26
|
-
constructor(data,
|
|
26
|
+
constructor(data, _client) {
|
|
27
27
|
this._data = data;
|
|
28
28
|
// Client instance not currently used but kept for future extensibility
|
|
29
29
|
}
|
|
@@ -11,9 +11,9 @@ export declare class HealthCheck {
|
|
|
11
11
|
/**
|
|
12
12
|
* Create a HealthCheck instance.
|
|
13
13
|
* @param data - The health check data
|
|
14
|
-
* @param
|
|
14
|
+
* @param client - Reference to the Client instance (unused but kept for consistency)
|
|
15
15
|
*/
|
|
16
|
-
constructor(data: any,
|
|
16
|
+
constructor(data: any, client: any);
|
|
17
17
|
/**
|
|
18
18
|
* Check if the service is healthy.
|
|
19
19
|
* @returns True if the service is healthy
|
|
@@ -17,9 +17,9 @@ export class HealthCheck {
|
|
|
17
17
|
/**
|
|
18
18
|
* Create a HealthCheck instance.
|
|
19
19
|
* @param data - The health check data
|
|
20
|
-
* @param
|
|
20
|
+
* @param client - Reference to the Client instance (unused but kept for consistency)
|
|
21
21
|
*/
|
|
22
|
-
constructor(data,
|
|
22
|
+
constructor(data, client) {
|
|
23
23
|
// Initialize properties
|
|
24
24
|
this.healthy = data.healthy || false;
|
|
25
25
|
this.status = data.status || 'unknown';
|
|
@@ -24,6 +24,17 @@ export type ILinkedInUser = {
|
|
|
24
24
|
picture: string;
|
|
25
25
|
getUrn(): string;
|
|
26
26
|
};
|
|
27
|
+
export type IGoogleUser = {
|
|
28
|
+
iamProvider: IIAMProviderName;
|
|
29
|
+
sub: string;
|
|
30
|
+
email_verified: boolean;
|
|
31
|
+
name: string;
|
|
32
|
+
given_name: string;
|
|
33
|
+
family_name: string;
|
|
34
|
+
email: string;
|
|
35
|
+
picture: string;
|
|
36
|
+
locale: string;
|
|
37
|
+
};
|
|
27
38
|
export type IXUser = {
|
|
28
39
|
iamProvider: IIAMProviderName;
|
|
29
40
|
sub: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IUser } from './User';
|
|
2
|
-
export type IIAMProviderName = 'bluesky' | 'discord' | 'github' | 'linkedin' | 'okta' | 'x';
|
|
2
|
+
export type IIAMProviderName = 'bluesky' | 'discord' | 'github' | 'google' | 'linkedin' | 'okta' | 'x';
|
|
3
3
|
export type IIAMProviderSpec = {
|
|
4
4
|
name: IIAMProviderName;
|
|
5
5
|
oauth2CallbackServerRoute: string;
|
|
@@ -16,6 +16,7 @@ export declare class IAMProvidersSpecs {
|
|
|
16
16
|
static getProvider(providerIAMProvidersType: any): IIAMProviderSpec;
|
|
17
17
|
static readonly Bluesky: IIAMProviderSpec;
|
|
18
18
|
static readonly GitHub: IIAMProviderSpec;
|
|
19
|
+
static readonly Google: IIAMProviderSpec;
|
|
19
20
|
static readonly LinkedIn: IIAMProviderSpec;
|
|
20
21
|
static readonly Okta: IIAMProviderSpec;
|
|
21
22
|
}
|