@datalayer/core 1.1.66 → 1.2.12
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/README.md +43 -20
- package/lib/api/constants.d.ts +1 -1
- package/lib/api/constants.js +1 -1
- package/lib/api/contents/attachments.js +3 -7
- package/lib/api/contents/datasets.d.ts +48 -0
- package/lib/api/contents/datasets.js +44 -7
- package/lib/api/contents/runtimeMounts.js +1 -1
- package/lib/api/contents/sandboxUid.d.ts +13 -45
- package/lib/api/contents/sandboxUid.js +14 -65
- package/lib/api/evals/client.d.ts +402 -0
- package/lib/api/evals/client.js +359 -0
- package/lib/api/evals/index.d.ts +10 -0
- package/lib/api/evals/index.js +18 -0
- package/lib/api/evals/request.d.ts +43 -0
- package/lib/api/evals/request.js +67 -0
- package/lib/api/evals/status.d.ts +27 -0
- package/lib/api/evals/status.js +122 -0
- package/lib/api/evals/types.d.ts +1335 -0
- package/lib/api/evals/types.js +5 -0
- package/lib/api/iam/authentication.js +6 -4
- package/lib/api/iam/connectedAgents.d.ts +29 -0
- package/lib/api/iam/connectedAgents.js +35 -0
- package/lib/api/iam/healthz.js +2 -2
- package/lib/api/iam/identityProviders.d.ts +76 -0
- package/lib/api/iam/identityProviders.js +187 -0
- package/lib/api/iam/index.d.ts +1 -0
- package/lib/api/iam/index.js +1 -0
- package/lib/api/iam/mcpPolicy.d.ts +102 -1
- package/lib/api/iam/mcpPolicy.js +38 -2
- package/lib/api/iam/oauth2.js +18 -12
- package/lib/api/iam/profile.d.ts +17 -1
- package/lib/api/iam/profile.js +27 -0
- package/lib/api/iam/scimTokens.d.ts +79 -0
- package/lib/api/iam/scimTokens.js +141 -0
- package/lib/api/iam/secrets.js +10 -23
- package/lib/api/iam/trials.d.ts +38 -0
- package/lib/api/iam/trials.js +66 -0
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.js +4 -0
- package/lib/api/mcp/observability.d.ts +34 -11
- package/lib/api/mcp/observability.js +97 -59
- package/lib/api/orchestration/client.d.ts +53 -0
- package/lib/api/orchestration/client.js +105 -0
- package/lib/api/orchestration/events.d.ts +88 -0
- package/lib/api/orchestration/events.js +245 -0
- package/lib/api/orchestration/generated.d.ts +693 -0
- package/lib/api/orchestration/generated.js +687 -0
- package/lib/api/orchestration/index.d.ts +30 -0
- package/lib/api/orchestration/index.js +34 -0
- package/lib/api/orchestration/lifecycle.d.ts +39 -0
- package/lib/api/orchestration/lifecycle.js +57 -0
- package/lib/api/orchestration/measures.d.ts +55 -0
- package/lib/api/orchestration/measures.js +99 -0
- package/lib/api/otel/dashboards.d.ts +56 -0
- package/lib/api/otel/dashboards.js +50 -0
- package/lib/api/otel/index.d.ts +1 -0
- package/lib/api/otel/index.js +1 -0
- package/lib/api/otel/metrics.d.ts +16 -0
- package/lib/api/otel/metrics.js +15 -0
- package/lib/api/scheduler/client.d.ts +32 -0
- package/lib/api/scheduler/client.js +42 -0
- package/lib/api/scheduler/index.d.ts +8 -0
- package/lib/api/scheduler/index.js +16 -0
- package/lib/api/scheduler/request.d.ts +28 -0
- package/lib/api/scheduler/request.js +50 -0
- package/lib/api/scheduler/types.d.ts +88 -0
- package/lib/api/scheduler/types.js +5 -0
- package/lib/api/spacer/comments.d.ts +97 -0
- package/lib/api/spacer/comments.js +45 -0
- package/lib/api/spacer/index.d.ts +9 -0
- package/lib/api/spacer/index.js +17 -0
- package/lib/api/spacer/notebooks.d.ts +33 -0
- package/lib/api/spacer/notebooks.js +39 -0
- package/lib/api/spacer/request.d.ts +25 -0
- package/lib/api/spacer/request.js +46 -0
- package/lib/api/spacer/spaces.d.ts +68 -0
- package/lib/api/spacer/spaces.js +45 -0
- package/lib/api/utils/validation.d.ts +4 -4
- package/lib/api/utils/validation.js +10 -7
- package/lib/client/auth/strategies.js +1 -1
- package/lib/client/constants.d.ts +1 -0
- package/lib/client/constants.js +1 -0
- package/lib/client/mixins/IAMMixin.js +2 -2
- package/lib/components/animation/AnimatedText.d.ts +1 -44
- package/lib/components/animation/AnimatedText.js +6 -122
- package/lib/components/anonymous/AnonymousKeyExpired.d.ts +56 -0
- package/lib/components/anonymous/AnonymousKeyExpired.js +96 -0
- package/lib/components/anonymous/AnonymousKeyTimer.d.ts +63 -0
- package/lib/components/anonymous/AnonymousKeyTimer.js +140 -0
- package/lib/components/anonymous/index.d.ts +7 -0
- package/lib/components/anonymous/index.js +15 -0
- package/lib/components/avatars/UserAvatar.d.ts +7 -1
- package/lib/components/avatars/UserAvatar.js +15 -1
- package/lib/components/billing/BillingEntitySelect.d.ts +6 -0
- package/lib/components/billing/BillingEntitySelect.js +49 -10
- package/lib/components/billing/eligibility.d.ts +22 -0
- package/lib/components/billing/eligibility.js +27 -0
- package/lib/components/billing/index.d.ts +1 -0
- package/lib/components/billing/index.js +1 -0
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/checkout/StripeCheckout.js +1 -1
- package/lib/components/collaboration/LiveEditorCollaborators.d.ts +5 -0
- package/lib/components/collaboration/LiveEditorCollaborators.js +3 -1
- package/lib/components/display/DatalayerBox.d.ts +2 -3
- package/lib/components/display/DatalayerBox.js +1 -1
- package/lib/components/display/NavLink.js +3 -2
- package/lib/components/display/VisuallyHidden.d.ts +1 -2
- package/lib/components/labels/StatusLabels.d.ts +2 -10
- package/lib/components/labels/StatusLabels.js +2 -26
- package/lib/components/principal/PrincipalAppearance.d.ts +21 -42
- package/lib/components/principal/PrincipalAppearance.js +232 -174
- package/lib/components/principal/PrincipalAvatar.d.ts +8 -1
- package/lib/components/principal/PrincipalAvatar.js +2 -2
- package/lib/components/principal/PrincipalDetailsOverlay.d.ts +8 -1
- package/lib/components/principal/PrincipalDetailsOverlay.js +2 -2
- package/lib/components/screencapture/Screencapture.js +46 -3
- package/lib/components/sharing/ShareAccessComponent.d.ts +45 -4
- package/lib/components/sharing/ShareAccessComponent.js +110 -78
- package/lib/components/sharing/SharingEditor.d.ts +5 -1
- package/lib/components/sharing/SharingEditor.js +9 -4
- package/lib/components/sharing/index.d.ts +1 -0
- package/lib/components/sharing/index.js +1 -0
- package/lib/components/sharing/sandboxSharing.d.ts +26 -0
- package/lib/components/sharing/sandboxSharing.js +47 -0
- package/lib/components/spaces/SpaceDetailsOverlay.d.ts +39 -0
- package/lib/components/spaces/SpaceDetailsOverlay.js +80 -0
- package/lib/components/spaces/SpaceDisplay.d.ts +38 -0
- package/lib/components/spaces/SpaceDisplay.js +92 -0
- package/lib/components/spaces/index.d.ts +4 -0
- package/lib/components/spaces/index.js +7 -0
- package/lib/components/spaces/spaceDisplayModel.d.ts +93 -0
- package/lib/components/spaces/spaceDisplayModel.js +170 -0
- package/lib/config/Configuration.d.ts +4 -4
- package/lib/config/Configuration.js +7 -7
- package/lib/config/index.d.ts +1 -0
- package/lib/config/index.js +1 -0
- package/lib/config/planes.d.ts +45 -0
- package/lib/config/planes.js +53 -0
- package/lib/hooks/cacheConverters.d.ts +0 -7
- package/lib/hooks/cacheConverters.js +0 -25
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useBackdrop.d.ts +4 -5
- package/lib/hooks/useBillingEntityStore.js +3 -0
- package/lib/hooks/useCache.d.ts +197 -44
- package/lib/hooks/useCache.js +1586 -494
- package/lib/hooks/useContents.d.ts +22 -1
- package/lib/hooks/useContents.js +90 -21
- package/lib/hooks/useMcp.d.ts +87 -1
- package/lib/hooks/useMcp.js +248 -13
- package/lib/hooks/useNavigate.d.ts +41 -3
- package/lib/hooks/useNavigate.js +116 -52
- package/lib/hooks/usePrincipalCacheStore.js +3 -0
- package/lib/hooks/usePrincipalStore.js +3 -0
- package/lib/hooks/useSpaceCacheStore.d.ts +50 -0
- package/lib/hooks/useSpaceCacheStore.js +85 -0
- package/lib/hooks/useWindowSize.js +1 -1
- package/lib/models/CreditsDTO.d.ts +6 -5
- package/lib/models/CreditsDTO.js +7 -5
- package/lib/models/IAMProvidersSpecs.d.ts +10 -5
- package/lib/models/IAMProvidersSpecs.js +0 -23
- package/lib/models/McpBinding.d.ts +6 -0
- package/lib/models/Organization.d.ts +69 -0
- package/lib/models/Organization.js +96 -0
- package/lib/models/Secret.d.ts +1 -2
- package/lib/models/Secret.js +2 -18
- package/lib/models/StartedBy.d.ts +34 -0
- package/lib/models/StartedBy.js +36 -0
- package/lib/models/Team.d.ts +2 -0
- package/lib/models/Team.js +2 -0
- package/lib/models/User.d.ts +4 -0
- package/lib/models/User.js +3 -0
- package/lib/models/UserSettings.d.ts +13 -0
- package/lib/models/UserSettings.js +9 -0
- package/lib/models/contents/__fixtures__/v1-contracts.json +158 -30
- package/lib/navigation/adapters/react-router.d.ts +1 -1
- package/lib/navigation/adapters/react-router.js +3 -0
- package/lib/navigation/components.js +2 -3
- package/lib/routes/publicPaths.js +4 -0
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.js +1 -0
- package/lib/state/sessionEnd.d.ts +55 -0
- package/lib/state/sessionEnd.js +162 -0
- package/lib/state/substates/CoreState.js +3 -16
- package/lib/state/substates/IAMState.d.ts +3 -3
- package/lib/state/substates/IAMState.js +7 -0
- package/lib/state/substates/LayoutState.js +12 -0
- package/lib/state/substates/NavigationState.d.ts +82 -0
- package/lib/state/substates/NavigationState.js +255 -0
- package/lib/state/substates/ProfileState.d.ts +1 -0
- package/lib/state/substates/ProfileState.js +1 -0
- package/lib/state/substates/index.d.ts +1 -0
- package/lib/state/substates/index.js +1 -0
- package/lib/utils/Lazy.d.ts +20 -0
- package/lib/utils/Lazy.js +32 -6
- package/lib/utils/Screencapture.d.ts +15 -0
- package/lib/utils/Screencapture.js +26 -20
- package/lib/utils/WithSuspense.d.ts +11 -1
- package/lib/utils/WithSuspense.js +11 -1
- package/lib/views/mcp/AdmittedClients.d.ts +44 -0
- package/lib/views/mcp/AdmittedClients.js +59 -0
- package/lib/views/mcp/ApprovalQueue.d.ts +66 -0
- package/lib/views/mcp/ApprovalQueue.js +95 -0
- package/lib/views/mcp/ConnectedAgents.js +38 -3
- package/lib/views/mcp/EnterpriseConsole.d.ts +1 -1
- package/lib/views/mcp/EnterpriseConsole.js +23 -1
- package/lib/views/mcp/IdentityProviders.d.ts +33 -0
- package/lib/views/mcp/IdentityProviders.js +299 -0
- package/lib/views/mcp/McpDashboard.js +90 -7
- package/lib/views/mcp/McpHome.js +1 -1
- package/lib/views/mcp/McpObservability.d.ts +30 -1
- package/lib/views/mcp/McpObservability.js +105 -19
- package/lib/views/mcp/NotebookRuns.d.ts +39 -0
- package/lib/views/mcp/NotebookRuns.js +44 -0
- package/lib/views/mcp/OrganizationPolicy.js +2 -1
- package/lib/views/mcp/PersonalPolicy.js +2 -1
- package/lib/views/mcp/PolicyForm.d.ts +17 -1
- package/lib/views/mcp/PolicyForm.js +25 -3
- package/lib/views/mcp/PolicyHistory.d.ts +13 -0
- package/lib/views/mcp/PolicyHistory.js +14 -1
- package/lib/views/mcp/RunDetail.d.ts +87 -0
- package/lib/views/mcp/RunDetail.js +186 -0
- package/lib/views/mcp/ScimProvisioning.d.ts +54 -0
- package/lib/views/mcp/ScimProvisioning.js +173 -0
- package/lib/views/mcp/TeamPolicies.js +66 -5
- package/lib/views/mcp/ToolAccess.d.ts +60 -0
- package/lib/views/mcp/ToolAccess.js +101 -0
- package/lib/views/mcp/TraceTimeline.d.ts +81 -0
- package/lib/views/mcp/TraceTimeline.js +132 -0
- package/lib/views/mcp/index.d.ts +5 -0
- package/lib/views/mcp/index.js +5 -0
- package/lib/views/otel/simpleAuthStore.js +3 -0
- package/lib/views/secrets/SecretEdit.js +3 -2
- package/lib/views/secrets/SecretNew.js +5 -1
- package/package.json +271 -264
- package/scripts/generate-mcp-types.py +16 -10
- package/scripts/generate-orchestration-types.py +920 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { create } from 'zustand';
|
|
6
|
+
import { registerSessionState } from '../state/sessionEnd.js';
|
|
7
|
+
const MERGEABLE_KEYS = [
|
|
8
|
+
'rootId',
|
|
9
|
+
'handle',
|
|
10
|
+
'displayName',
|
|
11
|
+
'description',
|
|
12
|
+
'variant',
|
|
13
|
+
'isPublic',
|
|
14
|
+
'accountHandle',
|
|
15
|
+
];
|
|
16
|
+
function hasMeaningfulValue(value) {
|
|
17
|
+
if (value === undefined || value === null) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (typeof value === 'string') {
|
|
21
|
+
return value.trim().length > 0;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
export const useSpaceCacheStore = create((set, get) => ({
|
|
26
|
+
spaces: {},
|
|
27
|
+
uidByRootId: {},
|
|
28
|
+
getSpace: uid => {
|
|
29
|
+
const key = String(uid || '').trim();
|
|
30
|
+
return key ? get().spaces[key] : undefined;
|
|
31
|
+
},
|
|
32
|
+
getSpaceByRootId: rootId => {
|
|
33
|
+
const key = String(rootId || '').trim();
|
|
34
|
+
const uid = key ? get().uidByRootId[key] : undefined;
|
|
35
|
+
return uid ? get().spaces[uid] : undefined;
|
|
36
|
+
},
|
|
37
|
+
upsertSpace: entry => {
|
|
38
|
+
const uid = String(entry.uid || '').trim();
|
|
39
|
+
if (!uid) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const existing = get().spaces[uid];
|
|
43
|
+
const merged = { ...existing, uid };
|
|
44
|
+
for (const field of MERGEABLE_KEYS) {
|
|
45
|
+
const incoming = entry[field];
|
|
46
|
+
if (hasMeaningfulValue(incoming)) {
|
|
47
|
+
merged[field] = incoming;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Nothing new: skip the update, so every mounted SpaceDisplay does not
|
|
51
|
+
// re-render for a snapshot it already has.
|
|
52
|
+
if (existing &&
|
|
53
|
+
MERGEABLE_KEYS.every(field => merged[field] === existing[field])) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
merged.updatedAt = Date.now();
|
|
57
|
+
const rootId = String(merged.rootId || '').trim();
|
|
58
|
+
set(state => ({
|
|
59
|
+
spaces: { ...state.spaces, [uid]: merged },
|
|
60
|
+
uidByRootId: rootId && state.uidByRootId[rootId] !== uid
|
|
61
|
+
? { ...state.uidByRootId, [rootId]: uid }
|
|
62
|
+
: state.uidByRootId,
|
|
63
|
+
}));
|
|
64
|
+
},
|
|
65
|
+
clearSpace: uid => {
|
|
66
|
+
const key = String(uid || '').trim();
|
|
67
|
+
set(state => {
|
|
68
|
+
const existing = state.spaces[key];
|
|
69
|
+
if (!existing) {
|
|
70
|
+
return state;
|
|
71
|
+
}
|
|
72
|
+
const spaces = { ...state.spaces };
|
|
73
|
+
delete spaces[key];
|
|
74
|
+
const uidByRootId = { ...state.uidByRootId };
|
|
75
|
+
if (existing.rootId && uidByRootId[existing.rootId] === key) {
|
|
76
|
+
delete uidByRootId[existing.rootId];
|
|
77
|
+
}
|
|
78
|
+
return { spaces, uidByRootId };
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
reset: () => set({ spaces: {}, uidByRootId: {} }),
|
|
82
|
+
}));
|
|
83
|
+
export default useSpaceCacheStore;
|
|
84
|
+
// What one session resolved is not the next one's to paint.
|
|
85
|
+
registerSessionState({ forget: () => useSpaceCacheStore.getState().reset() });
|
|
@@ -21,7 +21,7 @@ export interface CreditReservation {
|
|
|
21
21
|
resource: string;
|
|
22
22
|
/** Last update timestamp */
|
|
23
23
|
last_update: string;
|
|
24
|
-
/** Burning rate (credits per
|
|
24
|
+
/** Burning rate (credits per second) for this reservation */
|
|
25
25
|
burning_rate: number;
|
|
26
26
|
/** Start date of the reservation */
|
|
27
27
|
start_date: string;
|
|
@@ -81,7 +81,8 @@ export declare class CreditsDTO {
|
|
|
81
81
|
*/
|
|
82
82
|
get netAvailable(): number;
|
|
83
83
|
/**
|
|
84
|
-
* Get runtime reservations
|
|
84
|
+
* Get runtime reservations: the ones held for a runtime, which a
|
|
85
|
+
* reservation names by the runtime's uid.
|
|
85
86
|
*/
|
|
86
87
|
get runtimeReservations(): CreditReservation[];
|
|
87
88
|
/**
|
|
@@ -91,7 +92,7 @@ export declare class CreditsDTO {
|
|
|
91
92
|
/**
|
|
92
93
|
* Calculate maximum runtime in minutes based on environment burning rate.
|
|
93
94
|
*
|
|
94
|
-
* @param burningRate - Credits consumed per
|
|
95
|
+
* @param burningRate - Credits consumed per second
|
|
95
96
|
* @returns Maximum runtime in minutes
|
|
96
97
|
*/
|
|
97
98
|
calculateMaxRuntimeMinutes(burningRate: number): number;
|
|
@@ -99,7 +100,7 @@ export declare class CreditsDTO {
|
|
|
99
100
|
* Calculate credits needed for runtime duration.
|
|
100
101
|
*
|
|
101
102
|
* @param minutes - Runtime duration in minutes
|
|
102
|
-
* @param burningRate - Credits consumed per
|
|
103
|
+
* @param burningRate - Credits consumed per second
|
|
103
104
|
* @returns Credits needed
|
|
104
105
|
*/
|
|
105
106
|
calculateCreditsFromMinutes(minutes: number, burningRate: number): number;
|
|
@@ -107,7 +108,7 @@ export declare class CreditsDTO {
|
|
|
107
108
|
* Check if user has enough credits for runtime.
|
|
108
109
|
*
|
|
109
110
|
* @param minutes - Runtime duration in minutes
|
|
110
|
-
* @param burningRate - Credits consumed per
|
|
111
|
+
* @param burningRate - Credits consumed per second
|
|
111
112
|
* @returns True if user has enough credits
|
|
112
113
|
*/
|
|
113
114
|
hasEnoughCreditsForRuntime(minutes: number, burningRate: number): boolean;
|
package/lib/models/CreditsDTO.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module models/CreditsDTO
|
|
9
9
|
*/
|
|
10
|
+
import { isSandboxUid } from '../api/contents/sandboxUid.js';
|
|
10
11
|
import { validateJSON } from '../api/utils/validation.js';
|
|
11
12
|
/**
|
|
12
13
|
* Credits model representing user's available credits and usage.
|
|
@@ -67,10 +68,11 @@ export class CreditsDTO {
|
|
|
67
68
|
return Math.max(0, this.available - this.totalReserved);
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
|
-
* Get runtime reservations
|
|
71
|
+
* Get runtime reservations: the ones held for a runtime, which a
|
|
72
|
+
* reservation names by the runtime's uid.
|
|
71
73
|
*/
|
|
72
74
|
get runtimeReservations() {
|
|
73
|
-
return this._reservations.filter(r => r.id
|
|
75
|
+
return this._reservations.filter(r => isSandboxUid(r.resource) || isSandboxUid(r.id));
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
76
78
|
* Check if there are any active runtime reservations.
|
|
@@ -81,7 +83,7 @@ export class CreditsDTO {
|
|
|
81
83
|
/**
|
|
82
84
|
* Calculate maximum runtime in minutes based on environment burning rate.
|
|
83
85
|
*
|
|
84
|
-
* @param burningRate - Credits consumed per
|
|
86
|
+
* @param burningRate - Credits consumed per second
|
|
85
87
|
* @returns Maximum runtime in minutes
|
|
86
88
|
*/
|
|
87
89
|
calculateMaxRuntimeMinutes(burningRate) {
|
|
@@ -94,7 +96,7 @@ export class CreditsDTO {
|
|
|
94
96
|
* Calculate credits needed for runtime duration.
|
|
95
97
|
*
|
|
96
98
|
* @param minutes - Runtime duration in minutes
|
|
97
|
-
* @param burningRate - Credits consumed per
|
|
99
|
+
* @param burningRate - Credits consumed per second
|
|
98
100
|
* @returns Credits needed
|
|
99
101
|
*/
|
|
100
102
|
calculateCreditsFromMinutes(minutes, burningRate) {
|
|
@@ -105,7 +107,7 @@ export class CreditsDTO {
|
|
|
105
107
|
* Check if user has enough credits for runtime.
|
|
106
108
|
*
|
|
107
109
|
* @param minutes - Runtime duration in minutes
|
|
108
|
-
* @param burningRate - Credits consumed per
|
|
110
|
+
* @param burningRate - Credits consumed per second
|
|
109
111
|
* @returns True if user has enough credits
|
|
110
112
|
*/
|
|
111
113
|
hasEnoughCreditsForRuntime(minutes, burningRate) {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { IUser } from './User';
|
|
2
2
|
export type IIAMProviderName = 'bluesky' | 'discord' | 'github' | 'google' | 'linkedin' | 'okta' | 'x';
|
|
3
|
+
/** Providers whose access token is intentionally available to browser code. */
|
|
4
|
+
export type IBrowserTokenProviderName = Exclude<IIAMProviderName, 'bluesky' | 'linkedin'>;
|
|
3
5
|
export type IIAMProviderSpec = {
|
|
4
6
|
name: IIAMProviderName;
|
|
5
7
|
oauth2CallbackServerRoute: string;
|
|
6
8
|
oauth2CallbackUIRoute: string;
|
|
9
|
+
};
|
|
10
|
+
/** Provider metadata used only when its access token may be read by the UI. */
|
|
11
|
+
export type IBrowserTokenProviderSpec = IIAMProviderSpec & {
|
|
12
|
+
name: IBrowserTokenProviderName;
|
|
7
13
|
accessTokenCookieName: (user: IUser) => string;
|
|
8
14
|
refreshTokenCookieName: string;
|
|
9
15
|
userInfoURL: string;
|
|
@@ -13,11 +19,10 @@ export type IIAMProviderSpec = {
|
|
|
13
19
|
};
|
|
14
20
|
export declare class IAMProvidersSpecs {
|
|
15
21
|
private constructor();
|
|
16
|
-
static getProvider(providerIAMProvidersType:
|
|
17
|
-
static readonly
|
|
18
|
-
static readonly
|
|
19
|
-
static readonly Google: IIAMProviderSpec;
|
|
22
|
+
static getProvider(providerIAMProvidersType: IBrowserTokenProviderName): IBrowserTokenProviderSpec;
|
|
23
|
+
static readonly GitHub: IBrowserTokenProviderSpec;
|
|
24
|
+
static readonly Google: IBrowserTokenProviderSpec;
|
|
20
25
|
static readonly LinkedIn: IIAMProviderSpec;
|
|
21
|
-
static readonly Okta:
|
|
26
|
+
static readonly Okta: IBrowserTokenProviderSpec;
|
|
22
27
|
}
|
|
23
28
|
export default IAMProvidersSpecs;
|
|
@@ -6,18 +6,12 @@ export class IAMProvidersSpecs {
|
|
|
6
6
|
constructor() { }
|
|
7
7
|
static getProvider(providerIAMProvidersType) {
|
|
8
8
|
switch (providerIAMProvidersType) {
|
|
9
|
-
case 'bluesky': {
|
|
10
|
-
return this.Bluesky;
|
|
11
|
-
}
|
|
12
9
|
case 'github': {
|
|
13
10
|
return this.GitHub;
|
|
14
11
|
}
|
|
15
12
|
case 'google': {
|
|
16
13
|
return this.Google;
|
|
17
14
|
}
|
|
18
|
-
case 'linkedin': {
|
|
19
|
-
return this.LinkedIn;
|
|
20
|
-
}
|
|
21
15
|
case 'okta': {
|
|
22
16
|
return this.Okta;
|
|
23
17
|
}
|
|
@@ -27,17 +21,6 @@ export class IAMProvidersSpecs {
|
|
|
27
21
|
}
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
|
-
static Bluesky = {
|
|
31
|
-
name: 'bluesky',
|
|
32
|
-
oauth2CallbackServerRoute: 'jupyter_iam/oauth2/callback',
|
|
33
|
-
oauth2CallbackUIRoute: '/iam/oauth2/bluesky/callback',
|
|
34
|
-
accessTokenCookieName: (user) => `__datalayer__bluesky_access_token_${user.id}`,
|
|
35
|
-
refreshTokenCookieName: '__datalayer__bluesky_refresh_token',
|
|
36
|
-
userInfoURL: '',
|
|
37
|
-
tokenRefreshURL: '',
|
|
38
|
-
postShareURL: '',
|
|
39
|
-
registerUploadURL: '',
|
|
40
|
-
};
|
|
41
24
|
static GitHub = {
|
|
42
25
|
name: 'github',
|
|
43
26
|
oauth2CallbackServerRoute: 'jupyter_iam/oauth2/callback',
|
|
@@ -64,12 +47,6 @@ export class IAMProvidersSpecs {
|
|
|
64
47
|
name: 'linkedin',
|
|
65
48
|
oauth2CallbackServerRoute: 'jupyter_iam/oauth2/callback',
|
|
66
49
|
oauth2CallbackUIRoute: '/iam/oauth2/linkedin/callback',
|
|
67
|
-
accessTokenCookieName: (user) => `__datalayer__linkedin_access_token_${user.id}`,
|
|
68
|
-
refreshTokenCookieName: '__datalayer__linkedin_refresh_token',
|
|
69
|
-
userInfoURL: 'https://api.linkedin.com/v2/userinfo',
|
|
70
|
-
tokenRefreshURL: '',
|
|
71
|
-
postShareURL: 'https://api.linkedin.com/v2/ugcPosts',
|
|
72
|
-
registerUploadURL: 'https://api.linkedin.com/v2/assets?action=registerUpload',
|
|
73
50
|
};
|
|
74
51
|
static Okta = {
|
|
75
52
|
name: 'okta',
|
|
@@ -30,6 +30,12 @@ export interface McpBinding {
|
|
|
30
30
|
sessionUid?: string | null;
|
|
31
31
|
/** The runtime, for a `sandbox` binding. */
|
|
32
32
|
sandboxUid?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* What Runtimes and the Operator know the sandbox by, which is **not** the
|
|
35
|
+
* handle. Sharing is addressed by this name; sending the handle instead is
|
|
36
|
+
* a `403` that reads as "you are not the owner".
|
|
37
|
+
*/
|
|
38
|
+
runtimeName?: string | null;
|
|
33
39
|
sandboxProvider?: string | null;
|
|
34
40
|
/** What the runtime reported it can do. */
|
|
35
41
|
capabilities?: string[];
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { ITeam } from './Team';
|
|
2
2
|
import { ISchool } from './School';
|
|
3
3
|
import { IOrganizationMember } from './OrganizationMember';
|
|
4
|
+
/**
|
|
5
|
+
* The agreements (AWS calls each a licence) of an AWS Marketplace organization.
|
|
6
|
+
*
|
|
7
|
+
* Read from `aws_licenses_s`, the JSON string IAM keeps on the organization
|
|
8
|
+
* document: a list of `{arn, status, agreement_id, offer_id, first_seen,
|
|
9
|
+
* deprovisioned_at, ended_at}`. Anything that does not parse is dropped
|
|
10
|
+
* rather than thrown on, and every ARN of `licenseArns` the JSON does not
|
|
11
|
+
* name is appended as an `active` agreement — which is what an organization
|
|
12
|
+
* written before the field existed holds, and what is left when the JSON is
|
|
13
|
+
* invalid. The same reading the services make, so the page and the API never
|
|
14
|
+
* disagree about which agreements exist.
|
|
15
|
+
*/
|
|
16
|
+
export declare function asAwsMarketplaceLicenses(raw: unknown, licenseArns?: string[]): IAwsMarketplaceLicense[];
|
|
4
17
|
/**
|
|
5
18
|
* Convert the raw user object to {@link IOrganization}.
|
|
6
19
|
*
|
|
@@ -9,6 +22,55 @@ import { IOrganizationMember } from './OrganizationMember';
|
|
|
9
22
|
*/
|
|
10
23
|
export declare function asOrganization(org: any): IOrganization;
|
|
11
24
|
export type IAnyOrganization = IOrganization | ISchool;
|
|
25
|
+
/**
|
|
26
|
+
* What an organization created from an AWS Marketplace subscription carries.
|
|
27
|
+
*
|
|
28
|
+
* The subscription status is the one AWS last told us, or `pending` until it
|
|
29
|
+
* does. `pending` no longer locks the organization — usage is postpaid and
|
|
30
|
+
* metered by AWS regardless; only `failed` and `cancelled` lock it read-only,
|
|
31
|
+
* and the API says so on every refused mutation. A subscription may carry
|
|
32
|
+
* several concurrent agreements, each identified by a licence ARN.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Where an agreement stands: `active` while the buyer is entitled under it,
|
|
36
|
+
* `ending` from the moment AWS says it is deprovisioned — the hour AWS gives
|
|
37
|
+
* to report its last usage — and `ended` once that hour has passed.
|
|
38
|
+
*/
|
|
39
|
+
export type IAwsMarketplaceLicenseStatus = 'active' | 'ending' | 'ended';
|
|
40
|
+
/** One agreement of an AWS Marketplace subscription; AWS calls it a licence. */
|
|
41
|
+
export type IAwsMarketplaceLicense = {
|
|
42
|
+
/** The licence ARN, which is how AWS names the agreement. */
|
|
43
|
+
arn: string;
|
|
44
|
+
status: IAwsMarketplaceLicenseStatus;
|
|
45
|
+
agreementId?: string;
|
|
46
|
+
offerId?: string;
|
|
47
|
+
/** When the platform first saw the agreement. */
|
|
48
|
+
firstSeen?: Date;
|
|
49
|
+
/** When AWS said the agreement was deprovisioned. */
|
|
50
|
+
deprovisionedAt?: Date;
|
|
51
|
+
/** When the hour to report its last usage ran out. */
|
|
52
|
+
endedAt?: Date;
|
|
53
|
+
};
|
|
54
|
+
export type IOrganizationAwsMarketplace = {
|
|
55
|
+
accountId: string;
|
|
56
|
+
productCode: string;
|
|
57
|
+
/** The AWS customer identifier, when the resolve or a notification gave one. */
|
|
58
|
+
customerIdentifier?: string;
|
|
59
|
+
/** The AWS offer this subscription was bought under, when known. */
|
|
60
|
+
offerId?: string;
|
|
61
|
+
/** Every agreement (licence ARN) seen for this subscription. */
|
|
62
|
+
licenseArns: string[];
|
|
63
|
+
/**
|
|
64
|
+
* Every agreement with its status and dates. An organization may hold
|
|
65
|
+
* several at once, and stays usable while at least one is `active`.
|
|
66
|
+
*/
|
|
67
|
+
licenses: IAwsMarketplaceLicense[];
|
|
68
|
+
subscriptionStatus: 'pending' | 'active' | 'failed' | 'cancelling' | 'cancelled' | string;
|
|
69
|
+
freeTrial: boolean;
|
|
70
|
+
dimensions: string[];
|
|
71
|
+
values: string[];
|
|
72
|
+
lastMeteredAt?: Date;
|
|
73
|
+
};
|
|
12
74
|
export type IBaseOrganization = {
|
|
13
75
|
id: string;
|
|
14
76
|
handle: string;
|
|
@@ -19,6 +81,13 @@ export type IBaseOrganization = {
|
|
|
19
81
|
avatarIcon?: string;
|
|
20
82
|
banner?: string;
|
|
21
83
|
public: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Where the organization came from, as a URN — an AWS Marketplace
|
|
86
|
+
* subscription, say. Absent for a native organization.
|
|
87
|
+
*/
|
|
88
|
+
origin?: string;
|
|
89
|
+
/** The subscription, for an organization whose origin is the AWS Marketplace. */
|
|
90
|
+
awsMarketplace?: IOrganizationAwsMarketplace;
|
|
22
91
|
creationDate: Date;
|
|
23
92
|
members: IOrganizationMember[];
|
|
24
93
|
setMembers: (members: IOrganizationMember[]) => void;
|
|
@@ -4,6 +4,78 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { asArray } from '../utils/index.js';
|
|
6
6
|
import { asUser } from './User.js';
|
|
7
|
+
const AWS_LICENSE_STATUSES = [
|
|
8
|
+
'active',
|
|
9
|
+
'ending',
|
|
10
|
+
'ended',
|
|
11
|
+
];
|
|
12
|
+
function asOptionalDate(value) {
|
|
13
|
+
if (!value) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const date = value instanceof Date ? value : new Date(String(value));
|
|
17
|
+
return Number.isNaN(date.getTime()) ? undefined : date;
|
|
18
|
+
}
|
|
19
|
+
function asOptionalString(value) {
|
|
20
|
+
const text = String(value ?? '').trim();
|
|
21
|
+
return text || undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The agreements (AWS calls each a licence) of an AWS Marketplace organization.
|
|
25
|
+
*
|
|
26
|
+
* Read from `aws_licenses_s`, the JSON string IAM keeps on the organization
|
|
27
|
+
* document: a list of `{arn, status, agreement_id, offer_id, first_seen,
|
|
28
|
+
* deprovisioned_at, ended_at}`. Anything that does not parse is dropped
|
|
29
|
+
* rather than thrown on, and every ARN of `licenseArns` the JSON does not
|
|
30
|
+
* name is appended as an `active` agreement — which is what an organization
|
|
31
|
+
* written before the field existed holds, and what is left when the JSON is
|
|
32
|
+
* invalid. The same reading the services make, so the page and the API never
|
|
33
|
+
* disagree about which agreements exist.
|
|
34
|
+
*/
|
|
35
|
+
export function asAwsMarketplaceLicenses(raw, licenseArns = []) {
|
|
36
|
+
let parsed = raw;
|
|
37
|
+
if (typeof raw === 'string') {
|
|
38
|
+
try {
|
|
39
|
+
parsed = raw.trim() ? JSON.parse(raw) : [];
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
parsed = [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const licenses = [];
|
|
46
|
+
const known = new Set();
|
|
47
|
+
for (const entry of Array.isArray(parsed) ? parsed : []) {
|
|
48
|
+
if (!entry || typeof entry !== 'object') {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const record = entry;
|
|
52
|
+
const arn = String(record.arn ?? '').trim();
|
|
53
|
+
if (!arn || known.has(arn)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
known.add(arn);
|
|
57
|
+
const status = String(record.status ?? '')
|
|
58
|
+
.trim()
|
|
59
|
+
.toLowerCase();
|
|
60
|
+
licenses.push({
|
|
61
|
+
arn,
|
|
62
|
+
status: AWS_LICENSE_STATUSES.includes(status) ? status : 'active',
|
|
63
|
+
agreementId: asOptionalString(record.agreement_id ?? record.agreementId),
|
|
64
|
+
offerId: asOptionalString(record.offer_id ?? record.offerId),
|
|
65
|
+
firstSeen: asOptionalDate(record.first_seen ?? record.firstSeen),
|
|
66
|
+
deprovisionedAt: asOptionalDate(record.deprovisioned_at ?? record.deprovisionedAt),
|
|
67
|
+
endedAt: asOptionalDate(record.ended_at ?? record.endedAt),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
for (const value of licenseArns) {
|
|
71
|
+
const arn = String(value ?? '').trim();
|
|
72
|
+
if (arn && !known.has(arn)) {
|
|
73
|
+
known.add(arn);
|
|
74
|
+
licenses.push({ arn, status: 'active' });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return licenses;
|
|
78
|
+
}
|
|
7
79
|
/**
|
|
8
80
|
* Convert the raw user object to {@link IOrganization}.
|
|
9
81
|
*
|
|
@@ -28,6 +100,30 @@ export function asOrganization(org) {
|
|
|
28
100
|
avatarIcon: org.avatar_icon_s ?? org.avatarIcon,
|
|
29
101
|
banner: org.banner_s ?? org.banner,
|
|
30
102
|
public: org.public_b,
|
|
103
|
+
// Where the organization came from — a URN such as
|
|
104
|
+
// `urn:dla:iam:ext::aws:<account>/<product>` — or nothing for a native one.
|
|
105
|
+
origin: org.origin_s ?? org.origin ?? undefined,
|
|
106
|
+
awsMarketplace: org.aws_account_id_s
|
|
107
|
+
? {
|
|
108
|
+
accountId: org.aws_account_id_s,
|
|
109
|
+
productCode: org.aws_product_code_s,
|
|
110
|
+
customerIdentifier: org.aws_customer_identifier_s || undefined,
|
|
111
|
+
offerId: org.aws_offer_identifier_s || undefined,
|
|
112
|
+
// Every agreement (licence ARN) seen for this subscription. A
|
|
113
|
+
// subscription may carry several concurrent agreements.
|
|
114
|
+
licenseArns: asArray(org.aws_license_arns_ss ?? []),
|
|
115
|
+
// The same agreements with what is known of each — status,
|
|
116
|
+
// agreement id, dates — read defensively from the JSON IAM keeps.
|
|
117
|
+
licenses: asAwsMarketplaceLicenses(org.aws_licenses_s, asArray(org.aws_license_arns_ss ?? [])),
|
|
118
|
+
subscriptionStatus: org.aws_subscription_status_s ?? 'pending',
|
|
119
|
+
freeTrial: Boolean(org.aws_free_trial_b),
|
|
120
|
+
dimensions: asArray(org.aws_dimensions_ss ?? []),
|
|
121
|
+
values: asArray(org.aws_values_ss ?? []),
|
|
122
|
+
lastMeteredAt: org.aws_last_metered_ts_dt
|
|
123
|
+
? new Date(org.aws_last_metered_ts_dt)
|
|
124
|
+
: undefined,
|
|
125
|
+
}
|
|
126
|
+
: undefined,
|
|
31
127
|
members,
|
|
32
128
|
teams: [],
|
|
33
129
|
creationDate: new Date(org.creation_ts_dt),
|
package/lib/models/Secret.d.ts
CHANGED
|
@@ -140,12 +140,11 @@ export declare class SecretDTO {
|
|
|
140
140
|
*/
|
|
141
141
|
constructor(data: SecretData, client: DatalayerCoreClient);
|
|
142
142
|
private _checkDeleted;
|
|
143
|
-
private _decodeValue;
|
|
144
143
|
get uid(): string;
|
|
145
144
|
get variant(): ISecretVariant;
|
|
146
145
|
get name(): string;
|
|
147
146
|
get description(): string;
|
|
148
|
-
/**
|
|
147
|
+
/** The value as its owner wrote it (PLAN_ENVS.md E3-05). */
|
|
149
148
|
get value(): string;
|
|
150
149
|
/**
|
|
151
150
|
* Update this secret.
|
package/lib/models/Secret.js
CHANGED
|
@@ -55,22 +55,6 @@ export class SecretDTO {
|
|
|
55
55
|
throw new Error(`Secret ${this._data.name_s} has been deleted and no longer exists`);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
_decodeValue(encodedValue) {
|
|
59
|
-
try {
|
|
60
|
-
if (typeof Buffer !== 'undefined') {
|
|
61
|
-
// Node.js environment
|
|
62
|
-
return Buffer.from(encodedValue, 'base64').toString();
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
// Browser environment
|
|
66
|
-
return atob(encodedValue);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.error('Failed to decode secret value:', error);
|
|
71
|
-
return encodedValue; // Return as-is if decode fails
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
58
|
// ========================================================================
|
|
75
59
|
// Properties
|
|
76
60
|
// ========================================================================
|
|
@@ -90,10 +74,10 @@ export class SecretDTO {
|
|
|
90
74
|
this._checkDeleted();
|
|
91
75
|
return this._data.description_t;
|
|
92
76
|
}
|
|
93
|
-
/**
|
|
77
|
+
/** The value as its owner wrote it (PLAN_ENVS.md E3-05). */
|
|
94
78
|
get value() {
|
|
95
79
|
this._checkDeleted();
|
|
96
|
-
return this.
|
|
80
|
+
return this._data.value_s;
|
|
97
81
|
}
|
|
98
82
|
// ========================================================================
|
|
99
83
|
// Action Methods
|
|
@@ -54,4 +54,38 @@ export declare const startedBy: (metadata: UsageMetadata) => StartedBy;
|
|
|
54
54
|
* search box that is already there rather than a second control beside it.
|
|
55
55
|
*/
|
|
56
56
|
export declare const startedBySearchTerms: (metadata: UsageMetadata) => string;
|
|
57
|
+
/** The choices a "started by" filter offers, `all` included. */
|
|
58
|
+
export type StarterFilter = 'all' | StartedByKind;
|
|
59
|
+
/** Those choices in the order they are drawn, with the words for each. */
|
|
60
|
+
export declare const STARTER_FILTERS: {
|
|
61
|
+
id: StarterFilter;
|
|
62
|
+
label: string;
|
|
63
|
+
}[];
|
|
64
|
+
/** Enough of a usage record to say who started the resource it is for. */
|
|
65
|
+
export interface StarterUsage {
|
|
66
|
+
/** The resource this reservation is for — a runtime's uid. */
|
|
67
|
+
id: string;
|
|
68
|
+
metadata: UsageMetadata;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Who started the resource a uid names, from the reservations in hand.
|
|
72
|
+
*
|
|
73
|
+
* `undefined` when no reservation for it has been read — which is a
|
|
74
|
+
* different answer from "a person did". `startedBy` reads a record with
|
|
75
|
+
* neither dimension as the reader's own work, and that is right *for a
|
|
76
|
+
* record*: the dimensions are written when the reservation is made, so their
|
|
77
|
+
* absence is meaningful. Their absence from a row that does not exist is
|
|
78
|
+
* not. Saying "You" while the reservations are still loading would put the
|
|
79
|
+
* reader's name on a runtime one of their agents started, in the one view
|
|
80
|
+
* built to tell those apart.
|
|
81
|
+
*/
|
|
82
|
+
export declare const startedByResource: (resourceUid: string, usages: readonly StarterUsage[] | null | undefined) => StartedBy | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Whether a row survives the filter.
|
|
85
|
+
*
|
|
86
|
+
* A row nobody could classify passes only `all`. Narrowing to "Your agents"
|
|
87
|
+
* and being shown rows that might be anything is not a narrower answer —
|
|
88
|
+
* it is the same answer with a claim attached.
|
|
89
|
+
*/
|
|
90
|
+
export declare const matchesStarter: (who: StartedBy | undefined, filter: StarterFilter) => boolean;
|
|
57
91
|
export default startedBy;
|
package/lib/models/StartedBy.js
CHANGED
|
@@ -78,4 +78,40 @@ export const startedBySearchTerms = (metadata) => {
|
|
|
78
78
|
}
|
|
79
79
|
return `agent ${who.clientId}`;
|
|
80
80
|
};
|
|
81
|
+
/** Those choices in the order they are drawn, with the words for each. */
|
|
82
|
+
export const STARTER_FILTERS = [
|
|
83
|
+
{ id: 'all', label: 'Anyone' },
|
|
84
|
+
{ id: 'person', label: 'You' },
|
|
85
|
+
{ id: 'agent', label: 'Your agents' },
|
|
86
|
+
{ id: 'service-agent', label: 'Service agents' },
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Who started the resource a uid names, from the reservations in hand.
|
|
90
|
+
*
|
|
91
|
+
* `undefined` when no reservation for it has been read — which is a
|
|
92
|
+
* different answer from "a person did". `startedBy` reads a record with
|
|
93
|
+
* neither dimension as the reader's own work, and that is right *for a
|
|
94
|
+
* record*: the dimensions are written when the reservation is made, so their
|
|
95
|
+
* absence is meaningful. Their absence from a row that does not exist is
|
|
96
|
+
* not. Saying "You" while the reservations are still loading would put the
|
|
97
|
+
* reader's name on a runtime one of their agents started, in the one view
|
|
98
|
+
* built to tell those apart.
|
|
99
|
+
*/
|
|
100
|
+
export const startedByResource = (resourceUid, usages) => {
|
|
101
|
+
const usage = (usages ?? []).find(entry => entry.id === resourceUid);
|
|
102
|
+
return usage ? startedBy(usage.metadata) : undefined;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Whether a row survives the filter.
|
|
106
|
+
*
|
|
107
|
+
* A row nobody could classify passes only `all`. Narrowing to "Your agents"
|
|
108
|
+
* and being shown rows that might be anything is not a narrower answer —
|
|
109
|
+
* it is the same answer with a claim attached.
|
|
110
|
+
*/
|
|
111
|
+
export const matchesStarter = (who, filter) => {
|
|
112
|
+
if (filter === 'all') {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
return who?.kind === filter;
|
|
116
|
+
};
|
|
81
117
|
export default startedBy;
|
package/lib/models/Team.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type IBaseTeam = {
|
|
|
11
11
|
avatarIcon?: string;
|
|
12
12
|
banner?: string;
|
|
13
13
|
public: boolean;
|
|
14
|
+
/** The origin of its organization, inherited at creation; absent for a native one. */
|
|
15
|
+
origin?: string;
|
|
14
16
|
creationDate: Date;
|
|
15
17
|
lastUpdateDate?: Date;
|
|
16
18
|
lastPublicationDate?: Date;
|
package/lib/models/Team.js
CHANGED
|
@@ -21,6 +21,8 @@ export function asTeam(t, organizationId) {
|
|
|
21
21
|
avatarIcon: t.avatar_icon_s ?? t.avatarIcon,
|
|
22
22
|
banner: t.banner_s ?? t.banner,
|
|
23
23
|
public: t.public_b,
|
|
24
|
+
// Inherited from the organization at creation; absent for a native one.
|
|
25
|
+
origin: t.origin_s ?? t.origin ?? undefined,
|
|
24
26
|
members,
|
|
25
27
|
organization: {
|
|
26
28
|
id: organizationId,
|
package/lib/models/User.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare class User implements IUser {
|
|
|
27
27
|
avatarUrl?: string;
|
|
28
28
|
avatarIcon?: string;
|
|
29
29
|
banner?: string;
|
|
30
|
+
/** Whether this account publishes what it orbits, on its public profile. */
|
|
31
|
+
showOrbits?: boolean;
|
|
30
32
|
origin?: string;
|
|
31
33
|
invites?: Array<IInvite>;
|
|
32
34
|
iamProviders: Array<IIAMProviderLinked>;
|
|
@@ -67,6 +69,8 @@ export type IUser = IBaseUser & {
|
|
|
67
69
|
avatarUrl?: string;
|
|
68
70
|
avatarIcon?: string;
|
|
69
71
|
banner?: string;
|
|
72
|
+
/** Whether this account publishes what it orbits, on its public profile. */
|
|
73
|
+
showOrbits?: boolean;
|
|
70
74
|
origin?: string;
|
|
71
75
|
invites?: Array<IInvite>;
|
|
72
76
|
iamProviders: Array<IIAMProviderLinked>;
|
package/lib/models/User.js
CHANGED
|
@@ -43,6 +43,8 @@ export class User {
|
|
|
43
43
|
avatarUrl;
|
|
44
44
|
avatarIcon;
|
|
45
45
|
banner;
|
|
46
|
+
/** Whether this account publishes what it orbits, on its public profile. */
|
|
47
|
+
showOrbits;
|
|
46
48
|
origin;
|
|
47
49
|
invites;
|
|
48
50
|
iamProviders;
|
|
@@ -68,6 +70,7 @@ export class User {
|
|
|
68
70
|
this.avatarUrl = u.avatar_url_s;
|
|
69
71
|
this.avatarIcon = u.avatar_icon_s ?? u.avatarIcon;
|
|
70
72
|
this.banner = u.banner_s ?? u.banner;
|
|
73
|
+
this.showOrbits = Boolean(u.show_orbits_b ?? u.showOrbits ?? false);
|
|
71
74
|
this.origin = u.origin_s;
|
|
72
75
|
this.joinDate = u.join_ts_dt ? new Date(u.join_ts_dt) : undefined;
|
|
73
76
|
this.credits = u.credits_i ? Number(u.credits_i) : 0;
|